Module llm_overrides

Module llm_overrides 

Source
Expand description

Session-scoped LLM override resolution helpers.

This module centralizes the business logic for applying a per-session provider/model override (see crate::agent_sessions::SessionLlmConfig) to an in-memory crate::config::AppConfig.

Goals:

  • Keep GUI/CLI thin (they provide session data + platform-specific secret lookup).
  • Ensure provider/model precedence and compatibility checks are consistent.

Structs§

EffectiveLlmConfig
The effective provider/model after applying session overrides.

Constants§

KNOWN_LLM_PROVIDERS
Known LLM provider identifiers.

Functions§

apply_basic_mode_session_llm_overrides
Apply session-scoped LLM overrides (for basic/non-TUI CLI mode) and return a cloned config together with the effective provider/model.
apply_cli_llm_overrides
Apply CLI-provided provider and/or model overrides to an in-memory config.
apply_cli_model_arg_overrides
Apply a CLI --model argument to the config.
apply_cli_provider_arg_override
Apply a CLI --provider argument to the config.
apply_cli_session_llm_overrides
Apply session-style LLM overrides for CLI adapters.
apply_session_llm_overrides
Apply session-scoped LLM overrides to an in-memory config and return the effective provider/model.
is_known_llm_provider
Returns true when provider matches one of the KNOWN_LLM_PROVIDERS (case-insensitive comparison).
normalize_session_llm_override
Normalize and (optionally) migrate session-scoped LLM selection state.
parse_model_selector_legacy_aware
Parse a legacy-aware selector string into a session override.
resolve_session_llm_override
Resolve the session-scoped LLM override from an AgentSession.
session_llm_config_from_cli_model_arg
Parse a CLI-style model selector (e.g. "provider:model" or "model") into a SessionLlmConfig.