Skip to content

Graphorin API reference v0.12.1


Graphorin API reference / @graphorin/embedder-ollama / / OllamaEmbedder

Class: OllamaEmbedder

Defined in: packages/embedder-ollama/src/index.ts:134

EmbedderProvider implementation that talks to the Ollama HTTP API.

Stable

Implements

Constructors

Constructor

ts
new OllamaEmbedder(options): OllamaEmbedder;

Defined in: packages/embedder-ollama/src/index.ts:148

Parameters

ParameterType
optionsOllamaEmbedderOptions

Returns

OllamaEmbedder

Methods

configHash()

ts
configHash(): string;

Defined in: packages/embedder-ollama/src/index.ts:209

Deterministic hash over the embedder's full configuration - including the discovered digest. A model upgrade in the same Ollama instance changes the digest (and therefore the hash), so lock-on-first correctly fires a migration path instead of silently reusing the same embedder_id.

Returns

string

Implementation of

EmbedderProvider.configHash


dim()

ts
dim(): number;

Defined in: packages/embedder-ollama/src/index.ts:191

Output dimension - the explicit dim option, the resolved width from the first embed(), or a known-family default. PS-11: throws for an unknown model with no dim hint instead of returning 0 (which the store would persist and use to create a float[0] vec0 table, silently breaking vector search). Pass dim for any model not in KNOWN_OLLAMA_MODEL_DIMS, or call embed() once first to resolve it.

Returns

number

Implementation of

EmbedderProvider.dim


embed()

ts
embed(texts, opts?): Promise<readonly Float32Array<ArrayBufferLike>[]>;

Defined in: packages/embedder-ollama/src/index.ts:219

Compute embeddings for a batch of texts. Returns one vector per text.

Parameters

ParameterType
textsreadonly string[]
optsEmbedOptions

Returns

Promise<readonly Float32Array&lt;ArrayBufferLike&gt;[]>

Implementation of

EmbedderProvider.embed


id()

ts
id(): string;

Defined in: packages/embedder-ollama/src/index.ts:177

The canonical embedder id - 'ollama:<model>@<dim-or-digest>'.

Returns

string

Implementation of

EmbedderProvider.id