pub trait LLM: Sync + Send {
    // Required methods
    fn generate<'life0, 'life1, 'async_trait>(
        &'life0 self,
        messages: &'life1 [Message]
    ) -> Pin<Box<dyn Future<Output = Result<GenerateResult, LLMError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn invoke<'life0, 'life1, 'async_trait>(
        &'life0 self,
        prompt: &'life1 str
    ) -> Pin<Box<dyn Future<Output = Result<String, LLMError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn stream<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _messages: &'life1 [Message]
    ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<StreamData, LLMError>> + Send>>, LLMError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn add_options(&mut self, _options: CallOptions) { ... }
    fn messages_to_string(&self, messages: &[Message]) -> String { ... }
}

Required Methods§

source

fn generate<'life0, 'life1, 'async_trait>( &'life0 self, messages: &'life1 [Message] ) -> Pin<Box<dyn Future<Output = Result<GenerateResult, LLMError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn invoke<'life0, 'life1, 'async_trait>( &'life0 self, prompt: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<String, LLMError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn stream<'life0, 'life1, 'async_trait>( &'life0 self, _messages: &'life1 [Message] ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<StreamData, LLMError>> + Send>>, LLMError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Provided Methods§

source

fn add_options(&mut self, _options: CallOptions)

This is usefull when you want to create a chain and override LLM options

source

fn messages_to_string(&self, messages: &[Message]) -> String

Implementors§

source§

impl<C: Config + Send + Sync> LLM for OpenAI<C>