ModelProvider

Trait ModelProvider 

Source
pub trait ModelProvider: Send + Sync {
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn generate<'life0, 'async_trait>(
        &'life0 self,
        context: ModelContext,
    ) -> Pin<Box<dyn Future<Output = Result<String, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn model_id(&self) -> &str;
    fn default_config(&self) -> GenerationConfig;
}
Expand description

Trait for model providers (e.g., Together.ai, OpenAI, local models)

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

The error type returned by this provider

Required Methods§

Source

fn generate<'life0, 'async_trait>( &'life0 self, context: ModelContext, ) -> Pin<Box<dyn Future<Output = Result<String, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Generate a response using the provided context

Source

fn model_id(&self) -> &str

Get the model identifier

Source

fn default_config(&self) -> GenerationConfig

Get the default configuration for this model

Implementors§