model_matches_spec(
model: BaseChatModel,
spec: str,
) -> bool| Name | Type | Description |
|---|---|---|
model* | BaseChatModel | Chat model instance to inspect. |
spec* | str | Model spec in |
Check whether a model instance already matches a string model spec.
Bare specs match by model identifier. Provider-prefixed specs match by both
model identifier and provider when the current model exposes a provider via
_get_ls_params; if the provider cannot be inspected, the check falls back
to identifier-only matching for backwards compatibility with custom models.
Provider comparison is normalized, so case, hyphen/underscore spelling, and
known aliases do not read as a mismatch (see _normalize_provider).
Assumes the provider:model convention (single colon separator).