Embedder
Contract for embedding text into dense vector representations.
Implementations may wrap any embedding provider: Vercel AI SDK models, OpenAI API directly, local models (Ollama, transformers.js), or third-party services (Cohere, Voyage, Jina).
Properties
Section titled “Properties”dimension?
Section titled “dimension?”readonly optional dimension?: number;The dimensionality of the embedding vectors produced by this embedder. May be undefined if the dimension is not known until the first embed() call.
readonly optional id?: string;Stable identity of the underlying embedding model, e.g.
"openai.embedding/text-embedding-3-small". Used by the ingest
manifest to lock an index to the model that built it — two different
models of the same dimension produce incompatible vector spaces, so a
silent swap degrades every query without erroring.
Methods
Section titled “Methods”embed()
Section titled “embed()”embed(text): Promise<readonly number[]>;Embed a single text string into a dense vector.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
Returns
Section titled “Returns”Promise<readonly number[]>
embedMany()
Section titled “embedMany()”embedMany(texts): Promise<readonly readonly number[][]>;Embed multiple text strings into dense vectors. Implementations SHOULD batch the underlying API calls where the provider supports it, rather than calling embed() in a loop.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
Returns
Section titled “Returns”Promise<readonly readonly number[][]>