---
url: >-
  https://adk.nht.io/api/@nhtio/adk/batteries/llm/ollama/adapter/classes/OllamaAdapter.md
description: >-
  Opinionated cross-environment LLM adapter for the native Ollama `/api/chat`
  wire shape.
---

# Class: OllamaAdapter

Defined in: [batteries/llm/ollama/adapter.ts:231](https://github.com/NHTIO/ADK/blob/v1.20260609.0/src/batteries/llm/ollama/adapter.ts#L231)

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

## Remarks

Construction validates options eagerly via [validateOptions](../../validation/functions/validateOptions.md) and throws
[@nhtio/adk/batteries/llm/ollama!E\_INVALID\_OLLAMA\_OPTIONS](../../exceptions/variables/E_INVALID_OLLAMA_OPTIONS.md) on failure. The returned instance is reusable: call
[OllamaAdapter.executor](#executor) once per `DispatchRunner` configuration to obtain a
[@nhtio/adk!DispatchExecutorFn](../../../../../dispatch_runner/type-aliases/DispatchExecutorFn.md) 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](https://github.com/NHTIO/ADK/blob/v1.20260609.0/src/batteries/llm/ollama/adapter.ts#L242)

#### Parameters

| Parameter | Type      | Description                                                                                                                  |
| --------- | --------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `options` | `unknown` | Constructor-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](../../exceptions/variables/E_INVALID_OLLAMA_OPTIONS.md) when `options` does not satisfy `ollamaOptionsSchema`.

## Properties

| Property                                    | Modifier   | Type       | Description                                               | Defined in                                                                                                                      |
| ------------------------------------------- | ---------- | ---------- | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
|  `STASH_KEY` | `readonly` | `"ollama"` | Customary key for per-iteration overrides on `ctx.stash`. | [batteries/llm/ollama/adapter.ts:233](https://github.com/NHTIO/ADK/blob/v1.20260609.0/src/batteries/llm/ollama/adapter.ts#L233) |

## Methods

### executor()

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

Defined in: [batteries/llm/ollama/adapter.ts:253](https://github.com/NHTIO/ADK/blob/v1.20260609.0/src/batteries/llm/ollama/adapter.ts#L253)

Returns a [@nhtio/adk!DispatchExecutorFn](../../../../../dispatch_runner/type-aliases/DispatchExecutorFn.md) bound to this adapter's baseline plus optional
executor-scope overrides.

#### Parameters

| Parameter    | Type                                                                                                                                                                 | Description                                                                                                           |
| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| `overrides?` | [`Partial`](https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype)<[`OllamaAdapterOptions`](../../types/interfaces/OllamaAdapterOptions.md)> | Optional executor-scope overrides. Higher precedence than the baseline, lower precedence than `ctx.stash[STASH_KEY]`. |

#### Returns

[`DispatchExecutorFn`](../../../../../dispatch_runner/type-aliases/DispatchExecutorFn.md)

***

### isOllamaAdapter()

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

Defined in: [batteries/llm/ollama/adapter.ts:939](https://github.com/NHTIO/ADK/blob/v1.20260609.0/src/batteries/llm/ollama/adapter.ts#L939)

Returns `true` when `value` is an OllamaAdapter instance.

#### Parameters

| Parameter | Type      |
| --------- | --------- |
| `value`   | `unknown` |

#### Returns

`value is OllamaAdapter`
