Everything llm4s needs to know about one embedding provider, supplied by the provider itself.
This is ProviderDescriptor's counterpart for the embedding half of the SPI, and it is deliberately a separate trait rather than a method on the chat descriptor: the two sets overlap but neither contains the other. OpenAI and Ollama supply both a chat client and an embedding provider, Voyage supplies only embeddings, and Anthropic only chat. Folding embeddings into ProviderDescriptor would force an embedding-only provider to implement buildClient and buildConfig only to fail them.
Constructs the embedding provider for an already-resolved config.
Constructs the embedding provider for an already-resolved config.
The config has been read and validated by the caller, so a Left here means something only this provider can detect — a model its API does not offer, say.
Canonical id, e.g. ProviderId("voyage"). Must be unique among the embedding providers in a registry.
Canonical id, e.g. ProviderId("voyage"). Must be unique among the embedding providers in a registry.
Chat and embedding ids live in separate namespaces, so a provider that supplies both — OpenAI, Ollama — uses the same id for each without a clash. That is what lets EMBEDDING_MODEL=ollama/nomic-embed-text and a named chat section with provider = "ollama" name the same provider.
Turns this provider's config section into the EmbeddingProviderConfig its client needs.
Turns this provider's config section into the EmbeddingProviderConfig its client needs.
The default implementation resolves model, base URL and API key against configSpec, which is all any of the project's own providers needs. Override it only for a provider whose config genuinely cannot be expressed that way.
Value parameters
modelOverride
the <model> half of EMBEDDING_MODEL=<id>/<model>, when the unified form was used. Takes precedence over the section.
section
the llm4s.embeddings.<id> section, already parsed, its apiKey already falling back to the shared llm4s.credentials.<id>.apiKey when it sets none. Empty rather than absent when the user configured nothing. Everything this method needs arrives typed, in here: a descriptor never reads configuration itself.
Vector dimensions of the models this provider knows, keyed by model name as it appears in EMBEDDING_MODEL=<id>/<model>.
Vector dimensions of the models this provider knows, keyed by model name as it appears in EMBEDDING_MODEL=<id>/<model>.
This is what ModelDimensionRegistry answers from, so a provider's dimensions travel with the provider rather than living in a central table in llm4s-core - which is how ollama came to have no entries at all while its documented configuration depended on them.
A model missing here still embeds; only a caller that needs its dimensionality up front is told it is unknown. Override dimensionsOf instead when model names have variants that share a size.