Ollama embeddings use the nativeDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/phpaisdk/ollama/llms.txt
Use this file to discover all available pages before exploring further.
/api/embed endpoint rather than the OpenAI-compatible one. This means the request and response format follow Ollama’s own schema, and batching multiple inputs in a single call is supported natively — Ollama returns one embedding vector per input in the same response.
The embedding adapter calls the native
/api/embed path, which is derived from nativeBaseUrl (not baseUrl). By default nativeBaseUrl is http://localhost:11434. See the configuration options page for how to change it.Basic single embedding
Batch embeddings
Pass an array of strings to embed multiple inputs in one request. The response contains oneEmbeddingData entry for each input, in the same order:
Provider options
The following provider-specific options can be passed throughproviderOptions('ollama', [...]):
| Option | Type | Description |
|---|---|---|
truncate | bool | Passed unchanged to Ollama. When false, inputs longer than the model context window are not silently truncated — Ollama returns an error instead. |
keep_alive | string | A duration string (e.g. '10m', '1h') controlling how long Ollama keeps the model loaded in memory after the request completes. |
dimensions | int | Requested output dimensions. You can also set this via the standard ->dimensions() fluent method. The installed model is the authority on which dimensions are actually supported. |
Response fields
The returnedEmbeddingResponse exposes the following fields:
$result->embeddings— An array ofEmbeddingDataobjects, one per input. Each has a.vectorproperty containing afloat[]of embedding values.$result->output->vector— Shorthand for$result->embeddings[0]->vector, the vector for the first (or only) input.$result->usage->inputTokens— The number of prompt tokens evaluated, taken from Ollama’sprompt_eval_countfield.$result->providerMetadata['ollama']— Provider-specific metadata returned by Ollama:model— The model name as reported by Ollama, falling back to the requested model ID if the server omits it.total_duration— Total request duration in nanoseconds.load_duration— Time spent loading the model into memory, in nanoseconds.
