Skip to main content

Provider

Trait Provider 

Source
pub trait Provider: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn stream<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: &'life1 ProviderRequest,
    ) -> Pin<Box<dyn Future<Output = Result<Receiver<StreamEvent>, ProviderError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Unified provider trait. Both Anthropic and OpenAI-compatible endpoints implement this.

Required Methods§

Source

fn name(&self) -> &str

Human-readable provider name.

Source

fn stream<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 ProviderRequest, ) -> Pin<Box<dyn Future<Output = Result<Receiver<StreamEvent>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Send a streaming request. Returns a channel of events.

Implementors§