Skip to main content

LanguageModel

Trait LanguageModel 

Source
pub trait LanguageModel: Send + Sync {
    // Required method
    fn stream<'life0, 'life1, 'async_trait>(
        &'life0 self,
        messages: &'life1 [Message],
    ) -> Pin<Box<dyn Future<Output = ProviderResult<Receiver<AgentEvent>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn stream_with_tools<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        messages: &'life1 [Message],
        tools: &'life2 [ToolDefinition],
    ) -> Pin<Box<dyn Future<Output = ProviderResult<Receiver<AgentEvent>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn request_preview(&self, _messages: &[Message]) -> Option<Value> { ... }
}

Required Methods§

Source

fn stream<'life0, 'life1, 'async_trait>( &'life0 self, messages: &'life1 [Message], ) -> Pin<Box<dyn Future<Output = ProviderResult<Receiver<AgentEvent>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Provided Methods§

Source

fn stream_with_tools<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, messages: &'life1 [Message], tools: &'life2 [ToolDefinition], ) -> Pin<Box<dyn Future<Output = ProviderResult<Receiver<AgentEvent>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn request_preview(&self, _messages: &[Message]) -> Option<Value>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§