pub struct ModelRegistry { /* private fields */ }Expand description
Stable since 0.63.0
Lightweight model registry for SDK/engine usage.
Stores model metadata (provider, base_url, API type, costs) without
authentication details. For CLI usage with auth integration, see
oxicode_store::CliModelRegistry.
Implementations§
Source§impl ModelRegistry
impl ModelRegistry
Sourcepub fn new() -> ModelRegistry
pub fn new() -> ModelRegistry
Create a new empty registry.
Sourcepub fn from_static() -> ModelRegistry
pub fn from_static() -> ModelRegistry
Create a registry pre-populated with all built-in static models.
This loads models from the embedded static database.
Sourcepub fn register(&self, model: Model)
pub fn register(&self, model: Model)
Register a model at runtime.
If a model with the same provider/model_id key already exists,
the new one replaces it.
Sourcepub fn unregister(&self, provider: &str, model_id: &str)
pub fn unregister(&self, provider: &str, model_id: &str)
Unregister a previously registered dynamic model.
Sourcepub fn lookup(&self, provider: &str, model_id: &str) -> Option<Model>
pub fn lookup(&self, provider: &str, model_id: &str) -> Option<Model>
Look up a model by provider and model ID.
Dynamic models take priority over static ones.
Sourcepub fn get(provider: &str, model_id: &str) -> Option<&'static Model>
pub fn get(provider: &str, model_id: &str) -> Option<&'static Model>
Get a model by provider/model ID (static models only).
Sourcepub fn get_by_provider(provider: &str) -> Vec<&'static Model>
pub fn get_by_provider(provider: &str) -> Vec<&'static Model>
Get all models from a provider (static only).
Sourcepub fn dynamic_models(&self) -> Vec<Model>
pub fn dynamic_models(&self) -> Vec<Model>
Get all dynamically registered models.
Trait Implementations§
Source§impl Default for ModelRegistry
impl Default for ModelRegistry
Source§fn default() -> ModelRegistry
fn default() -> ModelRegistry
Returns the “default value” for a type. Read more
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