Skip to main content

resolve_role

Function resolve_role 

Source
fn resolve_role(
    role: &str,
    backend_value: &str,
    spec_model: Option<&str>,
    api_key_env: &str,
    fallback: Option<&ModelConfig>,
) -> Result<ModelConfig>
Expand description

Resolve one role’s ModelConfig from its backend field value.

The model id comes from spec_model, else it inherits fallback (the planner) when that role runs on the same backend. The model is optional for subprocess CLIs (empty -> the CLI’s own default; a value like haiku is passed to the CLI) and required for the openai backend. For openai the URL and API key are also resolved; the coding API key falls back to the planner’s.