What an embedding provider needs from its section, and what to use when the section omits it.
The embedding counterpart of ProviderConfigSpec, with one structural difference worth knowing. Chat config is keyed by the user's ''instance'' name (llm4s.providers.my-openai.baseUrl), so a reference.conf fragment cannot express a per-provider default - it does not know the instance name. Embedding config is keyed by the ''provider id'' (llm4s.embeddings.openai), so a module's own reference.conf can and does bind that provider's environment variables.
The division is therefore: defaults live here, environment bindings live in the module's reference.conf. Before this existed the two were duplicated - reference.conf said baseUrl = "http://localhost:11434" and EmbeddingsConfigLoader said DefaultOllamaEmbeddingBaseUrl - and nothing kept them in step.
== The API key == The key is the section's own apiKey when it sets one, and otherwise the vendor's shared key, llm4s.credentials.<id>.apiKey, which the module's reference.conf binds to the vendor's variable (llm4s.credentials.openai.apiKey = ${?OPENAI_API_KEY}). The same shared key serves the vendor's chat sections, so one variable configures both. org.llm4s.config resolves that fallback before calling the descriptor; nothing here reads configuration.
Value parameters
- apiKeyEnv
-
the variables the module's
reference.confbinds tollm4s.credentials.<id>.apiKey, highest precedence first, named in the error when the key is missing. A declaration for the message only: the binding itself is thereference.confline, and each module's round-trip spec proves the two agree. Empty when nothing binds the shared key, and the error then names the shared path instead. - defaultApiKey
-
stand-in for a provider that takes a key but does not need a real one - Ollama running locally.
- defaultBaseUrl
-
base URL used when the section omits one.
- defaultModel
-
model used when neither
EMBEDDING_MODELnor the section names one. - modelEnv
-
the variable the module binds to the model, named likewise.
- requiresApiKey
-
the provider cannot work without a key; a missing one is an error.
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass Any