Embeds a single value using an embedding model.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/vercel/ai/llms.txt
Use this file to discover all available pages before exploring further.
Parameters
The embedding model to use.
The value that should be embedded.
Maximum number of retries per embedding model call. Set to 0 to disable retries.
Abort signal for canceling the embedding request.
Additional headers to include in the request. Only applicable for HTTP-based providers.
Additional provider-specific options. They are passed through to the provider from the AI SDK
and enable provider-specific functionality that can be fully encapsulated in the provider.
Optional telemetry configuration (experimental).
Returns
The value that was embedded.
The embedding vector as an array of numbers.
The token usage for the embedding operation.
Warnings from the embedding model provider (e.g., unsupported settings).
Additional provider-specific metadata.
Response metadata from the embedding model.
Examples
Basic embedding
With usage tracking
Multiple embeddings
For embedding multiple values efficiently, useembedMany instead: