Skip to main content

dispatch_family_factory

Function dispatch_family_factory 

Source
pub fn dispatch_family_factory(
    config: Option<&Config>,
    family: &str,
    alias: &str,
    key: Option<&str>,
    api_url: Option<&str>,
    opts: &ModelProviderRuntimeOptions,
) -> Result<Box<dyn ModelProvider>>
Expand description

Dispatch family construction by routing (family, alias) to the typed slot’s FamilyProviderFactory impl. Generated from for_each_model_provider_slot! so the family list lives in exactly one place — adding a row to the slot macro requires a corresponding impl, caught at compile time when the macro expands.

family is the canonicalized family name (post-V2 synonym mapping); alias is the per-family entry key (default, prod_v2, …).

config is Option so legacy entry points (tests, programmatic factory calls without agent context) can dispatch without a real Config — those fall back to the family struct’s Default impl, which gives compat-only families full functionality and bespoke families their unconfigured defaults (Azure errors helpfully on missing resource, etc.).