Skip to content
1 min read · 280 words

Class: OllamaAdapter

Defined in: batteries/llm/ollama/adapter.ts:231

Opinionated cross-environment LLM adapter for the native Ollama /api/chat wire shape.

Remarks

Construction validates options eagerly via validateOptions and throws @nhtio/adk/batteries/llm/ollama!E_INVALID_OLLAMA_OPTIONS on failure. The returned instance is reusable: call OllamaAdapter.executor once per DispatchRunner configuration to obtain a @nhtio/adk!DispatchExecutorFn bound to the baseline plus optional executor-scope overrides. Per-iteration overrides live on ctx.stash.ollama and take highest precedence; headers, helpers, retry, and the nested runtime options merge key-by-key across all three layers, every other field is replaced wholesale at the highest layer that sets it.

Constructors

Constructor

ts
new OllamaAdapter(options: unknown): OllamaAdapter;

Defined in: batteries/llm/ollama/adapter.ts:242

Parameters

ParameterTypeDescription
optionsunknownConstructor-baseline options. Re-validated on every iteration after per-dispatch and per-iteration overrides are layered in.

Returns

OllamaAdapter

Throws

@nhtio/adk/batteries/llm/ollama!E_INVALID_OLLAMA_OPTIONS when options does not satisfy ollamaOptionsSchema.

Properties

PropertyModifierTypeDescriptionDefined in
STASH_KEYreadonly"ollama"Customary key for per-iteration overrides on ctx.stash.batteries/llm/ollama/adapter.ts:233

Methods

executor()

ts
executor(overrides?: Partial<OllamaAdapterOptions>): DispatchExecutorFn;

Defined in: batteries/llm/ollama/adapter.ts:253

Returns a @nhtio/adk!DispatchExecutorFn bound to this adapter's baseline plus optional executor-scope overrides.

Parameters

ParameterTypeDescription
overrides?Partial<OllamaAdapterOptions>Optional executor-scope overrides. Higher precedence than the baseline, lower precedence than ctx.stash[STASH_KEY].

Returns

DispatchExecutorFn


isOllamaAdapter()

ts
static isOllamaAdapter(value: unknown): value is OllamaAdapter;

Defined in: batteries/llm/ollama/adapter.ts:939

Returns true when value is an OllamaAdapter instance.

Parameters

ParameterType
valueunknown

Returns

value is OllamaAdapter