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.
Value parameters
- apiKeyEnv
-
the environment variable this provider's key conventionally comes from, named in the error when it is missing.
- apiKeyPath
-
absolute config path this provider's key is read from when its own section carries none, e.g.
"llm4s.openai.apiKey". OpenAI's embedding endpoint takes the same key as its chat client, so users set it once. This is a ''declaration'', not a read:org.llm4s.configresolves it and hands the result back in the section, because reading configuration outside that package is what the configuration boundary forbids. Declaring it is also what makes the "missing key" error name the place the key would actually be set. - 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
-
likewise for the model.
- 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