Skip to main content

ModelRegistry

Struct ModelRegistry 

Source
pub struct ModelRegistry { /* private fields */ }
Expand description

A searchable collection of model entries.

Implementations§

Source§

impl ModelRegistry

Source

pub fn bundled() -> &'static Self

Returns the compile-time bundled registry.

Source

pub fn from_litellm_json(json: &[u8]) -> Self

Build a registry from parsed LiteLLM JSON bytes.

Source

pub fn tier(&self, model_id: &str) -> ModelTier

Capability/cost tier of a model, classified against this registry’s chat-model price distribution. Unknown models classify as ModelTier::Balanced.

Source

pub fn tier_of(&self, entry: &ModelEntry) -> ModelTier

Capability/cost tier of a specific registry entry.

Source

pub fn lookup(&self, model_id: &str) -> Option<&ModelEntry>

Exact match on the LiteLLM key, then version-suffix normalization.

Normalization strips trailing -vN[:M], -YYYYMMDD, -YYYY-MM-DD, @YYYYMMDD, and compact -MMDD checkpoint dates, rewrites a vMAJOR-MINOR token to vMAJOR.MINOR, and collapses vMAJOR.MINOR to vMAJOR when the dotted form is also a miss, so dated or versioned aliases resolve to the base model’s record. It never binds a bare query to a provider-scoped key (github_copilot/claude-sonnet-4 only answers github_copilot/ lookups) and never changes the model family: an unknown or retired ID returns None.

Source

pub fn models_for_provider( &self, provider: &Provider, ) -> impl Iterator<Item = &ModelEntry>

All models from a given provider.

Source

pub fn models_by_mode( &self, mode: ModelMode, ) -> impl Iterator<Item = &ModelEntry>

All models matching a given mode.

Source

pub fn models_with_ability( &self, ability: Ability, ) -> impl Iterator<Item = &ModelEntry>

All models with a specific ability.

Source

pub fn all(&self) -> impl Iterator<Item = &ModelEntry>

Iterate over all entries.

Source

pub const fn len(&self) -> usize

Total number of entries.

Source

pub const fn is_empty(&self) -> bool

Whether the registry is empty.

Trait Implementations§

Source§

impl Debug for ModelRegistry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.