Skip to content
1 min read · 299 words

Variable: defaultRenderLiteRtToolResult

ts
const defaultRenderLiteRtToolResult: (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<MessageContentItem> = renderLiteRtToolResult;

Defined in: src/batteries/llm/litert_lm/helpers.ts:410

Default renderLiteRtToolResult.

Render a @nhtio/adk!ToolCall's results into a LiteRT tool_response content item.

Parameters

ParameterTypeDescription
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; }) => stringOverride 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.toolCallToolCall-
input.unsupportedMediaPolicyUnsupportedMediaPolicy-
input.warn?(msg: string) => void-

Returns

Promise<MessageContentItem>

Remarks

A @nhtio/adk!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 (reusing the shared renderTrustedContent/renderUntrustedContent). Media results degrade to text via renderMediaToLiteRtContent's fallback path (LiteRT tool responses are text-shaped).