Expand description
Build the AI subsystem (model registry + provider clients + cache + call
log) from [ai] / [models] server configuration.
Secrets are resolved here, at startup: api_key_env names an environment
variable, never the key itself. A provider’s transport is its kind (or,
when omitted, inferred from the provider name): anthropic, local, or
otherwise an OpenAI-compatible endpoint (openai, Azure, vLLM, …). A single
local provider (its cache_dir) backs every local model; remote providers
are keyed by name and matched to each remote model’s provider.
Constants§
- CALL_
LOG_ 🔒CAPACITY - Retained
laminar.ai_callsrecords.
Functions§
- build_
ai_ 🔒runtime - Build the AI runtime from configuration, or
Noneif no models are configured. - build_
err 🔒 - build_
provider 🔒 - Build one remote provider client. Returns
Nonefor the local backend (it is the runtime’s separatelocal_provider, not an entry in the providers map). - maybe_
rate_ 🔒limit - Pace a provider to
requests_per_secondwhen configured, else leave it as-is. - provider_
kind 🔒 - A provider’s transport kind: its explicit
kind, else inferred from the name. - resolve_
key 🔒 - Resolve a provider’s API key from its
api_key_envenvironment variable.