Skip to content

LLM

Provider connections and named, concretely-configured models for LLM/embedding backends. Peer of the Resources domain: ProviderConfig plays the same role as ConnectionConfig, and ModelConfig plays the same role as DatabaseConfig.

ProviderConfig

A concrete LLM/embedding provider connection: provider key, base URL, API key. Stored in [providers.<name>].

Bases: BaseModel

Concrete connection to one LLM provider: which one, and how to reach it.

Peer of :class:~oa_configurator.domains.resources.schema.ConnectionConfig for LLM/embedding backends instead of databases. Referenced by :attr:ModelConfig.provider. Each entry under [providers] in config.toml maps to one instance of this model.

API keys are stored in plaintext for now, the same documented limitation ConnectionConfig.password already carries; secret management support is planned for a future release for both.

resolve

resolve(name: str) -> ResolvedProvider

Resolve this provider to a concrete, backend-ready connection.

ModelConfig

A named, reusable, concretely-configured model, served through a provider. Stored in [models.<name>].

Bases: BaseModel

A named, reusable, concretely-configured model.

Peer of :class:~oa_configurator.domains.resources.schema.DatabaseConfig for LLM/embedding backends instead of databases. The unit that consuming packages reference by name (e.g. a package's embedding_model_name field just names an entry here). Each entry under [models] in config.toml maps to one instance of this model.

resolve

resolve(name: str, stack: StackConfig) -> ResolvedModel

Resolve this model to a concrete, backend-ready configuration.

stack must already have passed :meth:StackConfig.validate_references, so self.provider is guaranteed to exist in stack.providers.

validate_embedding_configuration

validate_embedding_configuration() -> ModelConfig

Reject embedding dimensions on models without embedding support.

Resolved types

ProviderConfig.resolve() and ModelConfig.resolve() produce these. Resolver.resolve_provider()/resolve_model() are thin wrappers around the same two methods.

Concrete LLM provider connection, ready to be served through.

Attributes:

Name Type Description
name str

Logical name of the provider as declared in the config.

provider str

Provider key, e.g. 'ollama', 'llamacpp', 'openai'.

base_url (str, optional)

Resolved base URL for this deployment.

api_key (str, optional)

Resolved API key for this deployment.

Concrete, backend-agnostic model configuration. No explicit methods as it is just a data struct that can be used by the consuming package to construct a backend-specific model handle.

Attributes:

Name Type Description
name str

Logical name of the model as declared in the config.

provider ResolvedProvider

Resolved provider this model is served through.

model str

Model name or identifier passed to the provider.

embedding_dim (int, optional)

Embedding dimension override, or None to let the provider's own discovery determine it.

document_prefix (str, optional)

Prefix prepended to document/passage text before embedding, for asymmetric embedding models.

query_prefix (str, optional)

Prefix prepended to query text before embedding, for asymmetric embedding models.

embeddings bool

Whether this specific model supports the embeddings endpoint.

tool_use bool

Whether this specific model supports tool/function calling.

structured_output bool

Whether this specific model supports structured (schema-constrained) output.

extended_thinking bool

Whether this specific model supports reasoning/extended-thinking output.

configuration dict[str, Any]

Free-form per-model knobs (max_tokens, temperature, and so on) with no dedicated field.