Skip to main content

Module model_resolver

Module model_resolver 

Source
Expand description

Choosing a model from --model, settings and available credentials.

Port of packages/coding-agent/src/core/model-resolver.ts in pi v1.0.0.

Structs§

CliModel
The result of --model resolution.
PatternMatch
A pattern match, with a thinking level from a :level suffix.
ScopedModel
A model in the session’s scope, with the level its pattern named.

Constants§

DEFAULT_MODEL_PER_PROVIDER
The model pi picks for a provider when nothing else decides.
DEFAULT_THINKING_LEVEL
pi’s default thinking level.

Functions§

exact_match
A model by exact reference: provider/id, or a bare id that is unique.
initial_model
The starting model when --model is absent: the saved default if it has credentials, else the first authenticated provider’s default model, else the first authenticated model.
parse_pattern
Matches pattern (optionally pattern:level) against models.
resolve_cli_model
Resolves --provider and --model against every model, authenticated or not.
resolve_model_scope
pi’s resolveModelScopeFromModels: the models patterns select from models, in pattern order without duplicates, and a warning for each pattern that selects nothing or names an invalid level. A pattern is a glob over provider/id or the id, ignoring case, or a model pattern as --model takes. Either may end in :level.