pub struct LLMRegistry { /* private fields */ }
Expand description
Central registry for managing LLM providers and models
Implementations§
Source§impl LLMRegistry
impl LLMRegistry
Sourcepub fn new(storage: Arc<dyn AuthStorage>) -> Self
pub fn new(storage: Arc<dyn AuthStorage>) -> Self
Create new LLM registry with authentication storage
Sourcepub async fn initialize(&mut self) -> Result<()>
pub async fn initialize(&mut self) -> Result<()>
Initialize the registry with default configurations
Sourcepub async fn load_models_dev_configs(&mut self) -> Result<()>
pub async fn load_models_dev_configs(&mut self) -> Result<()>
Load configurations from models.dev API
Sourcepub async fn load_config_file(&mut self, path: &str) -> Result<()>
pub async fn load_config_file(&mut self, path: &str) -> Result<()>
Load configurations from file
Sourcepub async fn get_model(
&self,
provider_id: &str,
model_id: &str,
) -> Result<Arc<dyn LanguageModel>>
pub async fn get_model( &self, provider_id: &str, model_id: &str, ) -> Result<Arc<dyn LanguageModel>>
Get a model by provider and model ID
Sourcepub async fn get_model_from_string(
&self,
model_str: &str,
) -> Result<Arc<dyn LanguageModel>>
pub async fn get_model_from_string( &self, model_str: &str, ) -> Result<Arc<dyn LanguageModel>>
Get model from string (provider/model or just model)
Sourcepub async fn get_default_model(
&self,
provider_id: &str,
) -> Result<Arc<dyn LanguageModel>>
pub async fn get_default_model( &self, provider_id: &str, ) -> Result<Arc<dyn LanguageModel>>
Get default model for a provider
Sourcepub async fn get_best_model(&self) -> Result<Arc<dyn LanguageModel>>
pub async fn get_best_model(&self) -> Result<Arc<dyn LanguageModel>>
Get the best available model across all providers
Sourcepub async fn list_providers(&self) -> Vec<String>
pub async fn list_providers(&self) -> Vec<String>
List all available providers
Sourcepub async fn list_available_providers(&self) -> Vec<String>
pub async fn list_available_providers(&self) -> Vec<String>
List available providers (those that can authenticate)
Sourcepub async fn list_models(&self, provider_id: &str) -> Result<Vec<ModelConfig>>
pub async fn list_models(&self, provider_id: &str) -> Result<Vec<ModelConfig>>
List models for a provider
Sourcepub async fn clear_cache(&self)
pub async fn clear_cache(&self)
Clear model cache
Sourcepub async fn cache_stats(&self) -> HashMap<String, usize>
pub async fn cache_stats(&self) -> HashMap<String, usize>
Get cache statistics
Sourcepub async fn register_provider(&mut self, provider: Arc<dyn Provider>)
pub async fn register_provider(&mut self, provider: Arc<dyn Provider>)
Register a custom provider
Auto Trait Implementations§
impl Freeze for LLMRegistry
impl !RefUnwindSafe for LLMRegistry
impl Send for LLMRegistry
impl Sync for LLMRegistry
impl Unpin for LLMRegistry
impl !UnwindSafe for LLMRegistry
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
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>
Converts
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>
Converts
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