embedMany automatically splits large requests into smaller chunks if the model has a limit on how many embeddings can be generated in a single call.
Parameters
EmbeddingModel
required
The embedding model to use.
Array<string>
required
The values that should be embedded.
number
default:"2"
Maximum number of retries per embedding model call. Set to 0 to disable retries.
AbortSignal
Abort signal for canceling the embedding request.
Record<string, string>
Additional headers to include in the request. Only applicable for HTTP-based providers.
number
default:"Infinity"
Maximum number of concurrent requests. When the model supports parallel calls and there are multiple chunks,
this limits how many requests can run simultaneously.
ProviderOptions
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.
TelemetrySettings
Optional telemetry configuration (experimental).
Returns
Array<string>
The values that were embedded.
Array<number[]>
The embedding vectors as an array of number arrays. Each embedding corresponds to the input value at the same index.
{ tokens: number }
The total token usage for all embedding operations.
Array<CallWarning>
Warnings from the embedding model provider (e.g., unsupported settings).
ProviderMetadata
Additional provider-specific metadata aggregated from all requests.
Array<EmbeddingModelResponseMetadata>
Response metadata from all embedding model calls.