Interface: OllamaHelpers
Defined in: src/batteries/llm/ollama/types.ts:275
Full translation-helper contract for the native Ollama battery. Extends the wire-shape-agnostic ChatHelpersCommon (shared with the OpenAI battery) and adds the Ollama-WIRE-SPECIFIC members: flat timeline-message rendering (images[] + thinking), string-only tool-call-result rendering, and native-history assembly (tool_name, object-form tool-call arguments). There is no streaming tool-call delta accumulator — native /api/chat emits whole tool_calls per chunk.
Extends
Properties
| Property | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|
buildOllamaHistory | (input: { bucketOrder: ChatCompletionsBucketOrder; filterThoughts: (thoughts: Iterable<Thought>, mode: "all" | "all-self" | "latest-self", selfIdentity: string, replayCompatibility: readonly string[]) => Thought[]; memories: Iterable<Memory>; messages: Iterable<Message>; renderChatCompletionsSystemPrompt: (input: { bucketOrder: ChatCompletionsBucketOrder; memories: Iterable<Memory>; renderCtx?: unknown; renderFirstPartyRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string) => Promise<string>; renderMemories: (items: Iterable<{ attrs: MemoryAttrs; memory: Memory; }>) => string; renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderFirstPartyRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: ... | ...; estimatedTokens?: ... | ...; lineCount: number; }) => string) => Promise<string>; renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderRetrievableSafetyDirective: () => string; renderThirdPartyPrivateRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: ...; byteLength: ...; callId: ...; encoding?: ...; estimatedTokens?: ...; lineCount: ...; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderThirdPartyPublicRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: ...; byteLength: ...; callId: ...; encoding?: ...; estimatedTokens?: ...; lineCount: ...; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderRetrievableSafetyDirective: () => string; renderStandingInstructions: (items: Iterable<Tokenizable>, attrs?: StandingInstructionAttrs) => string; renderThirdPartyPrivateRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderThirdPartyPublicRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; retrievables: Iterable<Retrievable>; standingInstructions: Iterable<Tokenizable>; systemPrompt: Tokenizable; }) => Promise<string>; renderedToolCallResults: Map<ToolCall, string>; renderFirstPartyRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string) => Promise<string>; renderMemories: (items: Iterable<{ attrs: MemoryAttrs; memory: Memory; }>) => string; renderOllamaTimelineMessage: (input: { message: Message; selfIdentity: string; unsupportedMediaPolicy: UnsupportedMediaPolicy; warn?: (msg: string) => void; }) => Promise<OllamaMessage>; renderOllamaToolCallResult: (input: { 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>; renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderFirstPartyRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string) => Promise<string>; renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderRetrievableSafetyDirective: () => string; renderThirdPartyPrivateRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderThirdPartyPublicRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderRetrievableSafetyDirective: () => string; renderStandingInstructions: (items: Iterable<Tokenizable>, attrs?: StandingInstructionAttrs) => string; renderThirdPartyPrivateRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderThirdPartyPublicRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderThought: (content: string, attrs: ThoughtAttrs, payload?: unknown) => string; renderTrustedContent: (content: string, attrs: TrustedContentAttrs) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; replayCompatibility: readonly string[]; retrievables: Iterable<Retrievable>; selfIdentity: string; standingInstructions: Iterable<Tokenizable>; systemPrompt: Tokenizable; thoughts: Iterable<Thought>; thoughtSurfacing: "all" | "all-self" | "latest-self"; toolCalls: Iterable<ToolCall>; tools: ToolRegistry; unsupportedMediaPolicy: UnsupportedMediaPolicy; warn?: (msg: string) => void; }) => Promise<{ messages: OllamaMessage[]; reasoningPayloads: { id: string; payload: unknown; replayCompatibility: string; }[]; }> | Assembles the full native history (system prompt, buckets, timeline, thoughts) into messages. | - | src/batteries/llm/ollama/types.ts:294 |
descriptionToChatCompletionsJsonSchema | (d: DescriptionLike) => JsonSchema | Converts a validator describe() envelope into the Chat-Completions JSON-Schema subset. | ChatHelpersCommon.descriptionToChatCompletionsJsonSchema | src/batteries/llm/chat_common/types.ts:511 |
filterThoughts | (thoughts: Iterable<Thought>, mode: "all" | "all-self" | "latest-self", selfIdentity: string, replayCompatibility: readonly string[]) => Thought[] | Selects which thoughts to surface, by surfacing mode, self identity, and replay compatibility. | ChatHelpersCommon.filterThoughts | src/batteries/llm/chat_common/types.ts:599 |
renderArtifactHandleBody? | (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string | Renders the directions-bearing "handle" body for a non-inlined @nhtio/adk!SpooledArtifact tool result: metadata (callId/kind/byteLength/lineCount) plus the forged artifact_* tools the model should call to read it incrementally. Remarks Optional override seam. When omitted the battery uses the shared defaultRenderArtifactHandleBody. A consumer overrides it to change WHICH reader the model is steered toward first — e.g. promoting the JSON content-readers (artifact_json_get / artifact_json_keys) ahead of the metadata-only artifact_json_type for a small model that grabs the first listed tool. The tool list itself comes from the artifact's constructor.toolMethods; an override typically reorders or re-annotates that list before delegating to the default renderer. | ChatHelpersCommon.renderArtifactHandleBody | src/batteries/llm/chat_common/types.ts:571 |
renderChatCompletionsSystemPrompt | (input: { bucketOrder: ChatCompletionsBucketOrder; memories: Iterable<Memory>; renderCtx?: unknown; renderFirstPartyRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string) => Promise<string>; renderMemories: (items: Iterable<{ attrs: MemoryAttrs; memory: Memory; }>) => string; renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderFirstPartyRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string) => Promise<string>; renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderRetrievableSafetyDirective: () => string; renderThirdPartyPrivateRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderThirdPartyPublicRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderRetrievableSafetyDirective: () => string; renderStandingInstructions: (items: Iterable<Tokenizable>, attrs?: StandingInstructionAttrs) => string; renderThirdPartyPrivateRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderThirdPartyPublicRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; retrievables: Iterable<Retrievable>; standingInstructions: Iterable<Tokenizable>; systemPrompt: Tokenizable; }) => Promise<string> | Assembles the system-prompt message from its constituent buckets in ChatCompletionsBucketOrder. | ChatHelpersCommon.renderChatCompletionsSystemPrompt | src/batteries/llm/chat_common/types.ts:611 |
renderFirstPartyRetrievables | (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string) => Promise<string> | Renders first-party (trusted) retrievables into a single prompt block. | ChatHelpersCommon.renderFirstPartyRetrievables | src/batteries/llm/chat_common/types.ts:526 |
renderMemories | (items: Iterable<{ attrs: MemoryAttrs; memory: Memory; }>) => string | Renders memories (each with its attribute bag) into a single prompt block. | ChatHelpersCommon.renderMemories | src/batteries/llm/chat_common/types.ts:522 |
renderOllamaTimelineMessage | (input: { message: Message; selfIdentity: string; unsupportedMediaPolicy: UnsupportedMediaPolicy; warn?: (msg: string) => void; }) => Promise<OllamaMessage> | Renders a timeline message into a native Ollama message (images[] + thinking). | - | src/batteries/llm/ollama/types.ts:277 |
renderOllamaToolCallResult | (input: { 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> | Renders a tool call's result into a native Ollama tool-role message body (string-only). | - | src/batteries/llm/ollama/types.ts:284 |
renderRetrievableHandleBody? | (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string | Renders the directions-bearing "handle" body for a non-inlined @nhtio/adk!Retrievable whose content is a @nhtio/adk!SpooledArtifact: metadata (callId/kind/byteLength/lineCount) plus the forged artifact_* tools the model should call to read it incrementally. Remarks Optional override seam, the retrievable-side counterpart to renderArtifactHandleBody. When omitted the battery uses the shared defaultRenderRetrievableHandleBody. | ChatHelpersCommon.renderRetrievableHandleBody | src/batteries/llm/chat_common/types.ts:588 |
renderRetrievables | (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderFirstPartyRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string) => Promise<string>; renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderRetrievableSafetyDirective: () => string; renderThirdPartyPrivateRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderThirdPartyPublicRetrievables: (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string>; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string> | Assembles the full retrievables block: safety directive plus the trust-tiered sub-renderers. | ChatHelpersCommon.renderRetrievables | src/batteries/llm/chat_common/types.ts:547 |
renderRetrievableSafetyDirective | () => string | Renders the safety directive that precedes any retrievable content. | ChatHelpersCommon.renderRetrievableSafetyDirective | src/batteries/llm/chat_common/types.ts:524 |
renderStandingInstructions | (items: Iterable<Tokenizable>, attrs?: StandingInstructionAttrs) => string | Renders standing instructions into a single prompt block. | ChatHelpersCommon.renderStandingInstructions | src/batteries/llm/chat_common/types.ts:517 |
renderThirdPartyPrivateRetrievables | (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string> | Renders third-party private retrievables, wrapping each in the untrusted-content envelope. | ChatHelpersCommon.renderThirdPartyPrivateRetrievables | src/batteries/llm/chat_common/types.ts:539 |
renderThirdPartyPublicRetrievables | (items: Iterable<{ attrs: RetrievableAttrs; retrievable: Retrievable; }>, deps: { renderRetrievableHandleBody?: (input: { artifact: unknown; byteLength: number; callId: string; encoding?: string; estimatedTokens?: number; lineCount: number; }) => string; renderUntrustedContent: (content: string, attrs: UntrustedContentAttrs) => string; }) => Promise<string> | Renders third-party public retrievables, wrapping each in the untrusted-content envelope. | ChatHelpersCommon.renderThirdPartyPublicRetrievables | src/batteries/llm/chat_common/types.ts:531 |
renderThought | (content: string, attrs: ThoughtAttrs, payload?: unknown) => string | Renders a single thought into its prompt block, optionally carrying an opaque replay payload. | ChatHelpersCommon.renderThought | src/batteries/llm/chat_common/types.ts:597 |
renderTrustedContent | (content: string, attrs: TrustedContentAttrs) => string | Wraps trusted (first-party) text in the trusted-content trust envelope. | ChatHelpersCommon.renderTrustedContent | src/batteries/llm/chat_common/types.ts:515 |
renderUntrustedContent | (content: string, attrs: UntrustedContentAttrs) => string | Wraps untrusted (third-party) text in the untrusted-content trust envelope. | ChatHelpersCommon.renderUntrustedContent | src/batteries/llm/chat_common/types.ts:513 |
toolsToChatCompletionsTools | (tools: readonly ( | Tool<SpooledArtifact> | ArtifactTool)[], deps: { descriptionToChatCompletionsJsonSchema: (d: DescriptionLike) => JsonSchema; }) => ChatCompletionsTool[] | Translates the tool registry into the function-tool wire array advertised to the model. | ChatHelpersCommon.toolsToChatCompletionsTools | src/batteries/llm/chat_common/types.ts:606 |