Built-in model metadata catalog used for context budgeting.
This is the default implementation of the Alloy.ModelCatalog behaviour.
It ships a small, hand-curated set of entries so Alloy works out of the
box; it is not meant to track every model release. To use a richer or
self-maintained source (a static map, your own service, or an adapter over
llm_db), implement Alloy.ModelCatalog
and pass the module via the :model_catalog option.
Per-run tweaks that don't warrant a catalog module belong in
:model_metadata_overrides — overrides always win over any catalog.
Summary
Functions
Returns the known model catalog.
Returns the known context window limit for a model name
(Alloy.ModelCatalog callback).
Returns the known context window limit for a model name, consulting
overrides ahead of the built-in catalog.
Returns the default fallback context window for unknown models.
Returns the context window for model_name from overrides alone,
ignoring the built-in catalog.
Types
@type model_entry() :: %{ name: String.t(), limit: pos_integer(), suffix_patterns: [String.t() | Regex.t()] }
@type override_entry() :: pos_integer() | %{ :limit => pos_integer(), optional(:suffix_patterns) => [String.t() | Regex.t()] }
Functions
@spec catalog() :: [model_entry()]
Returns the known model catalog.
@spec context_window(String.t()) :: pos_integer() | nil
Returns the known context window limit for a model name
(Alloy.ModelCatalog callback).
Returns nil when the model is not in the built-in catalog.
@spec context_window( String.t(), %{optional(String.t()) => override_entry()} | [{String.t(), override_entry()}] ) :: pos_integer() | nil
Returns the known context window limit for a model name, consulting
overrides ahead of the built-in catalog.
overrides may provide exact-model or family overrides as either:
%{"model-name" => 1_000_000}%{"model-name" => %{limit: 1_000_000, suffix_patterns: ["", ~r/^-+$/]}}
For overrides that only provide a limit, existing catalog suffix patterns are reused when available; unknown models default to exact-match only.
Returns nil when the model is not in the current catalog or overrides.
@spec default_context_window() :: pos_integer()
Returns the default fallback context window for unknown models.
@spec override_window( String.t(), %{optional(String.t()) => override_entry()} | [{String.t(), override_entry()}] ) :: pos_integer() | nil
Returns the context window for model_name from overrides alone,
ignoring the built-in catalog.
Used to apply :model_metadata_overrides ahead of any
Alloy.ModelCatalog implementation. Returns nil when no override
matches.