Trait Provider

Source
pub trait Provider: Send + Sync {
    // Required methods
    fn id(&self) -> &str;
    fn name(&self) -> &str;
    fn base_url(&self) -> &str;
    fn api_version(&self) -> &str;
    fn list_models<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ModelInfo>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_model<'life0, 'life1, 'async_trait>(
        &'life0 self,
        model_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Model>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn health_check<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<ProviderHealth>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_config(&self) -> &ProviderConfig;
    fn update_config<'life0, 'async_trait>(
        &'life0 mut self,
        config: ProviderConfig,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_rate_limits<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<RateLimitInfo>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_usage<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<UsageStats>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Provider trait for LLM providers

Required Methods§

Source

fn id(&self) -> &str

Unique identifier for this provider

Source

fn name(&self) -> &str

Human-readable name of the provider

Source

fn base_url(&self) -> &str

Base URL for the provider’s API

Source

fn api_version(&self) -> &str

API version being used

Source

fn list_models<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<ModelInfo>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List of available models

Source

fn get_model<'life0, 'life1, 'async_trait>( &'life0 self, model_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Model>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get a specific model by ID

Source

fn health_check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<ProviderHealth>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Check if the provider is available (API reachable, credentials valid)

Source

fn get_config(&self) -> &ProviderConfig

Get provider-specific configuration

Source

fn update_config<'life0, 'async_trait>( &'life0 mut self, config: ProviderConfig, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Update provider configuration

Source

fn get_rate_limits<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<RateLimitInfo>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get rate limiting information

Source

fn get_usage<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<UsageStats>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get current usage statistics

Implementors§