@nhtio/adk/batteries/llm/ollama/types
TypeScript wire shapes, helper contracts, and option types for the native Ollama battery.
Remarks
Type aliases for the native Ollama /api/chat adapter — the native wire shapes (which differ from OpenAI Chat Completions: flat string content + separate base64 images[], thinking for reasoning, object-form tool-call arguments, tool_name on tool-role messages, NDJSON streaming terminated by done: true), the adapter's options shape, and the OllamaHelpers contract. Runtime validation lives in validation.ts (ollamaOptionsSchema).
Wire-shape-agnostic types (JsonSchema, the attribute envelopes, UnsupportedMediaPolicy, the bucket order, the retry config, the function-tool wire) are imported from the shared, internal ../chat_common/types submodule and re-exported here so consumers of @nhtio/adk/batteries/llm/ollama get a self-contained type surface.
Interfaces
| Interface | Description |
|---|---|
| OllamaAdapterOptions | Configuration options for the native Ollama /api/chat adapter. |
| OllamaChatRequestBody | The native /api/chat request body. |
| OllamaChatResponse | A non-streaming /api/chat response (single object with done: true). |
| OllamaChatStreamChunk | A streamed NDJSON chunk from /api/chat. The terminal chunk carries done: true + stats. |
| OllamaHelpers | 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. |
| OllamaMessage | A native Ollama chat message. Flat shape: content is always a string; image attachments ride in a separate base64 images[] array (no content blocks); thinking carries reasoning; a tool-role result message labels its origin with tool_name (NOT a tool_call_id). |
| OllamaRuntimeOptions | Native Ollama runtime/sampling parameters — sent NESTED under the request body's options key, NOT at the top level (this is the key structural divergence from the OpenAI wire, where these sit at the top level). All fields are optional; set only the ones you want to override. An index signature allows forward-compatible passthrough of llama.cpp parameters this type has not yet enumerated. |
| OllamaToolCall | A native Ollama tool call as returned on a response/stream message. Note: arguments is a parsed JSON OBJECT (not a string), and there is no id or type field — the adapter synthesizes a correlation id. |
Type Aliases
| Type Alias | Description |
|---|---|
| OllamaFormat | Native format control. 'json' requests free-form JSON; a JsonSchema object requests schema-constrained structured output (the model's content is then a JSON string matching it). |
| OllamaThink | Native think control for thinking-capable models. true/false toggle reasoning; the effort strings request a reasoning budget on models that support graded thinking. |
| OllamaTool | Native function-tool definition (structurally identical to the Chat Completions tool wire). |
References
ChatCompletionsBucketLabel
Re-exports ChatCompletionsBucketLabel
ChatCompletionsBucketOrder
Re-exports ChatCompletionsBucketOrder
ChatCompletionsRetryConfig
Re-exports ChatCompletionsRetryConfig
ChatCompletionsTool
Re-exports ChatCompletionsTool
ChatHelpersCommon
Re-exports ChatHelpersCommon
DescriptionLike
Re-exports DescriptionLike
JsonSchema
Re-exports JsonSchema
MemoryAttrs
Re-exports MemoryAttrs
RetrievableAttrs
Re-exports RetrievableAttrs
StandingInstructionAttrs
Re-exports StandingInstructionAttrs
ThoughtAttrs
Re-exports ThoughtAttrs
TrustedContentAttrs
Re-exports TrustedContentAttrs
UnsupportedMediaPolicy
Re-exports UnsupportedMediaPolicy
UntrustedContentAttrs
Re-exports UntrustedContentAttrs