Variable: defaultRenderTransformersJsToolResult
ts
const defaultRenderTransformersJsToolResult: (input: {
renderArtifactHandleBody?: (input: {
artifact: unknown;
byteLength: number;
callId: string;
encoding?: string;
estimatedTokens?: number;
lineCount: number;
}) => string;
renderTrustedContent: (content: string, attrs: TrustedContentAttrs) => string;
renderUntrustedContent: (
content: string,
attrs: UntrustedContentAttrs,
) => string;
results: Tokenizable | SpooledArtifact | Media | Media[] | SpooledArtifact[];
tool: Tool<SpooledArtifact> | ArtifactTool | undefined;
toolCall: ToolCall;
unsupportedMediaPolicy: UnsupportedMediaPolicy;
warn?: (msg: string) => void;
}) => Promise<string> = renderTransformersJsToolResult;Defined in: src/batteries/llm/transformers_js/helpers.ts:275
Default renderTransformersJsToolResult.
Render a @nhtio/adk!ToolCall's results into a plain-text tool message body.
Parameters
| Parameter | Type | Description |
|---|---|---|
input | { renderArtifactHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderTrustedContent: (content: string, attrs: TrustedContentAttrs) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; results: | Tokenizable | SpooledArtifact | Media | Media[] | SpooledArtifact[]; tool: | Tool<SpooledArtifact> | ArtifactTool | undefined; toolCall: ToolCall; unsupportedMediaPolicy: UnsupportedMediaPolicy; warn?: (msg: string) => void; } | - |
input.renderArtifactHandleBody? | (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string | Override for the artifact-handle body renderer (see renderArtifactHandleBody). Defaults to the shared defaultRenderArtifactHandleBody. The adapter threads the consumer's helpers.renderArtifactHandleBody here so an app can change which forged artifact_* reader the model is steered toward first. |
input.renderTrustedContent | (content: string, attrs: TrustedContentAttrs) => string | - |
input.renderUntrustedContent | (content: string, attrs: UntrustedContentAttrs) => string | - |
input.results | | Tokenizable | SpooledArtifact | Media | Media[] | SpooledArtifact[] | - |
input.tool | | Tool<SpooledArtifact> | ArtifactTool | undefined | - |
input.toolCall | ToolCall | - |
input.unsupportedMediaPolicy | UnsupportedMediaPolicy | - |
input.warn? | (msg: string) => void | - |
Returns
Promise<string>
Remarks
transformers.js chat templates take a tool-role message whose content is a string. A SpooledArtifact result renders as a HANDLE (metadata + the forged artifact_* tools to read it) when its ToolCall.inline === false — the secure default — and inline via asString() only when a producer opted into inline: true. Applies the trust envelope and degrades Media to text.