pub struct ModelRegistry { /* private fields */ }Expand description
A registry of supported models and their aliases, used to resolve user-facing model names to concrete provider-specific model entries.
The default registry is populated with all built-in models across supported providers (DeepSeek, NVIDIA NIM, OpenAI-compatible, and others).
Implementations§
Source§impl ModelRegistry
impl ModelRegistry
Sourcepub fn new(models: Vec<ModelInfo>) -> Self
pub fn new(models: Vec<ModelInfo>) -> Self
Creates a new registry from a list of ModelInfo entries.
Builds an internal alias map for fast lookup by model id or alias. If multiple models share the same id or alias, the first one registered takes priority.
Sourcepub fn resolve(
&self,
requested: Option<&str>,
provider_hint: Option<ProviderKind>,
) -> ModelResolution
pub fn resolve( &self, requested: Option<&str>, provider_hint: Option<ProviderKind>, ) -> ModelResolution
Resolves a user-requested model name to a concrete ModelInfo.
Resolution follows this priority order:
- If the provider is Ollama, the requested name is used as-is (to
support arbitrary local model tags like
qwen2.5-coder:7b). - If a
provider_hintis given, search for a model matching that provider whose id or alias matches the request (case-insensitive). - Look up the alias map for a case-insensitive match.
- Fall back to the first model belonging to the hinted provider (or DeepSeek if no hint was given).
- As a last resort, fall back to the first model in the registry.
Trait Implementations§
Source§impl Clone for ModelRegistry
impl Clone for ModelRegistry
Source§fn clone(&self) -> ModelRegistry
fn clone(&self) -> ModelRegistry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ModelRegistry
impl Debug for ModelRegistry
Auto Trait Implementations§
impl Freeze for ModelRegistry
impl RefUnwindSafe for ModelRegistry
impl Send for ModelRegistry
impl Sync for ModelRegistry
impl Unpin for ModelRegistry
impl UnsafeUnpin for ModelRegistry
impl UnwindSafe for ModelRegistry
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
Mutably borrows from an owned value. Read more