LlmProvider

Trait LlmProvider 

Source
pub trait LlmProvider: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn model(&self) -> &str;
    fn complete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: &'life1 CompletionRequest,
    ) -> Pin<Box<dyn Future<Output = Result<LlmResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn complete_stream<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: &'life1 CompletionRequest,
    ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<LlmChunk>> + Send>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Trait for LLM providers

Required Methods§

Source

fn name(&self) -> &str

Get provider name

Source

fn model(&self) -> &str

Get model name

Source

fn complete<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 CompletionRequest, ) -> Pin<Box<dyn Future<Output = Result<LlmResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Generate a completion (non-streaming)

Source

fn complete_stream<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 CompletionRequest, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<LlmChunk>> + Send>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Generate a streaming completion

Implementors§