Skip to main content

LLMBackend

Trait LLMBackend 

Source
pub trait LLMBackend: Send + Sync {
    // Required methods
    fn stream<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        options: &'life1 AgentOptions,
        messages: &'life2 [Message],
    ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<CreateChatCompletionStreamResponse>> + Send>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_json<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        options: &'life1 AgentOptions,
        messages: &'life2 [Message],
        schema: &'life3 Value,
    ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
}
Expand description

A pluggable LLM backend.

Required Methods§

Source

fn stream<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, options: &'life1 AgentOptions, messages: &'life2 [Message], ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<CreateChatCompletionStreamResponse>> + Send>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn get_json<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, options: &'life1 AgentOptions, messages: &'life2 [Message], schema: &'life3 Value, ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§