pub struct ModelRegistry { /* private fields */ }Expand description
Runtime model registry for dynamically registered models.
Unlike the static model_db, this supports adding/removing models at runtime.
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
oxi_store::CliModelRegistry.
Implementations§
Source§impl ModelRegistry
impl ModelRegistry
Sourcepub fn from_static() -> Self
pub fn from_static() -> Self
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.