Skip to main content

Provider

Trait Provider 

Source
pub trait Provider:
    Send
    + Sync
    + 'static {
    // Required methods
    fn stream<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        model: &'life1 Model,
        context: &'life2 Context,
        options: Option<StreamOptions>,
    ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = ProviderEvent> + Send>>, ProviderError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
    fn name(&self) -> &str;
}
Expand description

LLM provider trait

Implement this trait to add support for new LLM providers.

Required Methods§

Source

fn stream<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, model: &'life1 Model, context: &'life2 Context, options: Option<StreamOptions>, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = ProviderEvent> + Send>>, ProviderError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Stream assistant message events

Source

fn name(&self) -> &str

Get the provider name

Implementors§