pub struct Catalog { /* private fields */ }Expand description
Model facts by provider and model id.
Implementations§
Source§impl Catalog
impl Catalog
Sourcepub fn get(&self, provider: ProviderId, model: &str) -> Option<&ModelSpec>
pub fn get(&self, provider: ProviderId, model: &str) -> Option<&ModelSpec>
The model provider serves as model, by exact id. Any selection of
a vendor finds that vendor’s models.
Sourcepub fn resolve(&self, reference: &str) -> Option<&ModelSpec>
pub fn resolve(&self, reference: &str) -> Option<&ModelSpec>
The model a reference names: vendor/model
(anthropic/claude-opus-5-5, openrouter/anthropic/claude-sonnet-4.5)
or vendor[/format]:model as ProviderRef spells it. The second
form applies when the text before the first : is a vendor or a
vendor/format pair, so a model id holding a : (ollama/qwen3:4b)
still reads as the first.
Sourcepub fn from_json(json: &str) -> Result<Catalog, CatalogError>
pub fn from_json(json: &str) -> Result<Catalog, CatalogError>
Read a models.dev-style catalog: an object of provider keys, each
with a models object keyed by model id. A provider key is a
models.dev key (google, amazon-bedrock) or a rig vendor name
(gcp.gemini); a key that is neither is skipped, so models.dev’s own
api.json reads whole. Rig’s hand-entered facts go under each row’s
rig object.
Sourcepub fn merge(self, overrides: Catalog) -> Catalog
pub fn merge(self, overrides: Catalog) -> Catalog
This catalog with overrides laid over it. A model in both keeps
every field the override leaves out; a model only in overrides is
added.
Sourcepub fn find(&self, provider: ProviderId, model: &str) -> Option<&ModelSpec>
pub fn find(&self, provider: ProviderId, model: &str) -> Option<&ModelSpec>
The model provider serves as model, as the encoders look it up:
by exact id or, failing that, without a dated snapshot suffix
(-20251001, -2025-08-07), so claude-sonnet-4-5-20250929 finds
claude-sonnet-4-5. Self::get matches the exact id only.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Catalog
impl RefUnwindSafe for Catalog
impl Send for Catalog
impl Sync for Catalog
impl Unpin for Catalog
impl UnsafeUnpin for Catalog
impl UnwindSafe for Catalog
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more