Module factory
Expand description
Per-family construction dispatch for model providers.
Each <Family>ModelProviderConfig typed slot from
zeroclaw-config::providers::ModelProviders declares its own construction
via one of two traits:
-
CompatFamilySpecfor OpenAI-compatible families. DeclareDISPLAY/DEFAULT_URL/AUTH; the blanketimpl<T: CompatFamilySpec> FamilyProviderFactory for Tproduces the provider. Families with minor modifiers (.without_native_tools(),.models_dev_key(...), multi-endpoint URI fallback) overridebuild_compat— still one place per family, no flat dispatch arm. -
FamilyProviderFactorydirectly for bespoke families that wrap a non-compat runtime provider (azure,gemini,openrouter,bedrock,anthropic, …).
Dispatch is generated by for_each_model_provider_slot! — the same
macro that defines the typed slots is the only place the family list
lives. Adding a family is one slot row plus one trait impl; missing the
impl fails to compile when the dispatch is generated.
Enums§
- Provider
Endpoint - Family-level endpoint behavior when no operator alias is available.
Functions§
- apply_
compat_ options - Apply cross-cutting compat overrides (timeout, headers, api_path,
max_tokens, reasoning effort, TLS CA,
provider_extra,chat_template_kwargs) to a compat builder before calling.build()and boxing the trait object. Single source of the override chain — every compat impl funnels through here. - dispatch_
family_ factory - endpoint_
for_ family - Resolve endpoint behavior for one canonical provider family.
- get_
default_ url Deprecated - Get the fixed default API URL for a canonical provider family.