EmbeddingConfigSpec

org.llm4s.llmconnect.spi.EmbeddingConfigSpec
See theEmbeddingConfigSpec companion object
final case class EmbeddingConfigSpec(requiresApiKey: Boolean, defaultBaseUrl: Option[String], defaultModel: Option[String], defaultApiKey: Option[String], apiKeyPath: Option[String], apiKeyEnv: Option[String], modelEnv: Option[String])

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.config resolves 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_MODEL nor 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 Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product