Skip to main content

ProviderStore

Trait ProviderStore 

Source
pub trait ProviderStore: Send + Sync {
    // Required methods
    fn get_resolved_model<'life0, 'async_trait>(
        &'life0 self,
        model_id: ModelId,
    ) -> Pin<Box<dyn Future<Output = Result<Option<ResolvedModel>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_default_model<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<ResolvedModel>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for retrieving LLM provider and model configurations

This trait abstracts the database lookup and API key decryption needed to create LLM providers at runtime.

Implementations can:

  • Load from a database with encrypted API keys
  • Use in-memory configurations for testing
  • Load from environment variables for development

Required Methods§

Source

fn get_resolved_model<'life0, 'async_trait>( &'life0 self, model_id: ModelId, ) -> Pin<Box<dyn Future<Output = Result<Option<ResolvedModel>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get model with provider info by model ID

Returns the model string ID, provider type, decrypted API key, and base URL needed to create an LLM provider via the factory.

Source

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

Get the default model with provider info

Returns the system default model when an agent has no default_model_id set.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: ProviderStore + ?Sized> ProviderStore for Arc<T>

Source§

fn get_resolved_model<'life0, 'async_trait>( &'life0 self, model_id: ModelId, ) -> Pin<Box<dyn Future<Output = Result<Option<ResolvedModel>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

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

Implementors§