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§
Required Methods§
Sourcefn 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 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
Sourcefn default_config(&self) -> GenerationConfig
fn default_config(&self) -> GenerationConfig
Get the default configuration for this model