Skip to main content

LLMProvider

Trait LLMProvider 

Source
pub trait LLMProvider: Send + Sync {
    // Required method
    fn call<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        messages: &'life1 [Message],
        tools: &'life2 [ToolDefinition],
        stream_callback: Option<&'life3 mut StreamCallback>,
    ) -> Pin<Box<dyn Future<Output = Result<Message>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
}
Expand description

LLM provider trait for making API calls

Required Methods§

Source

fn call<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, messages: &'life1 [Message], tools: &'life2 [ToolDefinition], stream_callback: Option<&'life3 mut StreamCallback>, ) -> Pin<Box<dyn Future<Output = Result<Message>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Call the LLM with messages and available tools, returning the assistant’s response

If stream_callback is provided, the LLM will be invoked in streaming mode, calling the callback for each chunk of the response as it arrives.

Implementors§