ModelProvider

Trait ModelProvider 

Source
pub trait ModelProvider: Send + Sync {
    // Required methods
    fn generate<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        prompt: &'life1 str,
        config: &'life2 GenerationConfig,
    ) -> Pin<Box<dyn Future<Output = Result<ModelResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn stream<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        prompt: &'life1 str,
        config: &'life2 GenerationConfig,
    ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<String>> + Send>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn metadata(&self) -> ProviderMetadata;
    fn kind(&self) -> ProviderKind;
}
Expand description

Core trait that all model providers must implement

Required Methods§

Source

fn generate<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, prompt: &'life1 str, config: &'life2 GenerationConfig, ) -> Pin<Box<dyn Future<Output = Result<ModelResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Generate a response to the given prompt

Source

fn stream<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, prompt: &'life1 str, config: &'life2 GenerationConfig, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<String>> + Send>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Stream a response to the given prompt

Source

fn metadata(&self) -> ProviderMetadata

Get provider metadata

Source

fn kind(&self) -> ProviderKind

Get the provider kind

Implementors§