@nhtio/adk/batteries/llm/ollama
Native Ollama /api/chat adapter battery with swappable translation helpers and wire types.
Remarks
Opinionated native Ollama LLM battery. Ships an OllamaAdapter that targets Ollama's NATIVE /api/chat endpoint (NOT the OpenAI-compat /v1 layer — for that, point the openai_chat_completions battery at <host>/v1). Works with both local Ollama (http://localhost:11434, no auth) and cloud Ollama (https://ollama.com, Authorization: Bearer <apiKey>); the only difference is baseURL plus the auth header. Native Ollama is HTTP-only — a Unix-socket deployment is reached via a custom fetch or an external bridge.
Native /api/chat unlocks capabilities the /v1 compat layer cannot express: per-request context size (options.num_ctx), native reasoning (think + message.thinking), structured output (format), model lifecycle (keep_alive), object-form tool-call arguments, NDJSON streaming, and native generation stats (surfaced via the runner's generationStats observability channel).
Re-exports the adapter class, every translation helper (wire-shape-agnostic helpers are shared with the OpenAI battery via the internal chat_common submodule and re-exported here under their original names, each with a default* alias), the option / wire-shape types, the validation schema + validateOptions wrapper, and the battery-scoped exception classes.
Interfaces
| Interface | Description |
|---|---|
| ChatHelpersCommon | The wire-shape-agnostic subset of a Chat-family battery's translation helpers — every helper that produces a plain string (or JSON Schema / tool-definition wire, which is identical across the family) rather than a battery-specific message object. |
References
buildOllamaHistory
Re-exports buildOllamaHistory
ChatCompletionsBucketLabel
Re-exports ChatCompletionsBucketLabel
ChatCompletionsBucketOrder
Re-exports ChatCompletionsBucketOrder
ChatCompletionsRetryConfig
Re-exports ChatCompletionsRetryConfig
ChatCompletionsTool
Re-exports ChatCompletionsTool
defaultBuildOllamaHistory
Re-exports defaultBuildOllamaHistory
defaultDescriptionToChatCompletionsJsonSchema
Re-exports defaultDescriptionToChatCompletionsJsonSchema
defaultFilterThoughts
Re-exports defaultFilterThoughts
defaultOllamaToolsFromTools
Re-exports defaultOllamaToolsFromTools
defaultRenderChatCompletionsSystemPrompt
Re-exports defaultRenderChatCompletionsSystemPrompt
defaultRenderFirstPartyRetrievables
Re-exports defaultRenderFirstPartyRetrievables
defaultRenderMemories
Re-exports defaultRenderMemories
defaultRenderOllamaTimelineMessage
Re-exports defaultRenderOllamaTimelineMessage
defaultRenderOllamaToolCallResult
Re-exports defaultRenderOllamaToolCallResult
defaultRenderRetrievables
Re-exports defaultRenderRetrievables
defaultRenderRetrievableSafetyDirective
Re-exports defaultRenderRetrievableSafetyDirective
defaultRenderStandingInstructions
Re-exports defaultRenderStandingInstructions
defaultRenderThirdPartyPrivateRetrievables
Re-exports defaultRenderThirdPartyPrivateRetrievables
defaultRenderThirdPartyPublicRetrievables
Re-exports defaultRenderThirdPartyPublicRetrievables
defaultRenderThought
Re-exports defaultRenderThought
defaultRenderTrustedContent
Re-exports defaultRenderTrustedContent
defaultRenderUntrustedContent
Re-exports defaultRenderUntrustedContent
defaultToolsToChatCompletionsTools
Re-exports defaultToolsToChatCompletionsTools
DescriptionLike
Re-exports DescriptionLike
descriptionToChatCompletionsJsonSchema
Re-exports descriptionToChatCompletionsJsonSchema
E_INVALID_OLLAMA_OPTIONS
Re-exports E_INVALID_OLLAMA_OPTIONS
E_OLLAMA_CONTEXT_OVERFLOW
Re-exports E_OLLAMA_CONTEXT_OVERFLOW
E_OLLAMA_HTTP_ERROR
Re-exports E_OLLAMA_HTTP_ERROR
E_OLLAMA_INVALID_TOOL_CALL_ARGS
Re-exports E_OLLAMA_INVALID_TOOL_CALL_ARGS
E_OLLAMA_REQUEST_TIMEOUT
Re-exports E_OLLAMA_REQUEST_TIMEOUT
E_OLLAMA_STREAM_ERROR
Re-exports E_OLLAMA_STREAM_ERROR
E_OLLAMA_STREAM_STALLED
Re-exports E_OLLAMA_STREAM_STALLED
E_OLLAMA_UNSUPPORTED_MEDIA_MODALITY
Re-exports E_OLLAMA_UNSUPPORTED_MEDIA_MODALITY
filterThoughts
Re-exports filterThoughts
JsonSchema
Re-exports JsonSchema
MemoryAttrs
Re-exports MemoryAttrs
OllamaAdapter
Re-exports OllamaAdapter
OllamaAdapterOptions
Re-exports OllamaAdapterOptions
OllamaChatRequestBody
Re-exports OllamaChatRequestBody
OllamaChatResponse
Re-exports OllamaChatResponse
OllamaChatStreamChunk
Re-exports OllamaChatStreamChunk
OllamaFormat
Re-exports OllamaFormat
OllamaHelpers
Re-exports OllamaHelpers
OllamaMessage
Re-exports OllamaMessage
ollamaOptionsSchema
Re-exports ollamaOptionsSchema
OllamaRuntimeOptions
Re-exports OllamaRuntimeOptions
OllamaThink
Re-exports OllamaThink
OllamaTool
Re-exports OllamaTool
OllamaToolCall
Re-exports OllamaToolCall
ollamaToolsFromTools
Re-exports ollamaToolsFromTools
renderChatCompletionsSystemPrompt
Re-exports renderChatCompletionsSystemPrompt
renderFirstPartyRetrievables
Re-exports renderFirstPartyRetrievables
renderMemories
Re-exports renderMemories
renderOllamaTimelineMessage
Re-exports renderOllamaTimelineMessage
renderOllamaToolCallResult
Re-exports renderOllamaToolCallResult
renderRetrievables
Re-exports renderRetrievables
renderRetrievableSafetyDirective
Re-exports renderRetrievableSafetyDirective
renderStandingInstructions
Re-exports renderStandingInstructions
renderThirdPartyPrivateRetrievables
Re-exports renderThirdPartyPrivateRetrievables
renderThirdPartyPublicRetrievables
Re-exports renderThirdPartyPublicRetrievables
renderThought
Re-exports renderThought
renderTrustedContent
Re-exports renderTrustedContent
renderUntrustedContent
Re-exports renderUntrustedContent
RetrievableAttrs
Re-exports RetrievableAttrs
StandingInstructionAttrs
Re-exports StandingInstructionAttrs
ThoughtAttrs
Re-exports ThoughtAttrs
toolsToChatCompletionsTools
Re-exports toolsToChatCompletionsTools
TrustedContentAttrs
Re-exports TrustedContentAttrs
UnsupportedMediaPolicy
Re-exports UnsupportedMediaPolicy
UntrustedContentAttrs
Re-exports UntrustedContentAttrs
validateOptions
Re-exports validateOptions