Skip to main content

ChatModel

Trait ChatModel 

Source
pub trait ChatModel: Send + Sync {
    // Required method
    fn chat<'life0, 'async_trait>(
        &'life0 self,
        request: ChatRequest,
    ) -> Pin<Box<dyn Future<Output = Result<ChatResponse, SynapticError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn profile(&self) -> Option<ModelProfile> { ... }
    fn stream_chat(&self, request: ChatRequest) -> ChatStream<'_> { ... }
}
Expand description

The core trait for language model providers. Implementations provide chat() for single responses and optionally stream_chat() for streaming.

Required Methods§

Source

fn chat<'life0, 'async_trait>( &'life0 self, request: ChatRequest, ) -> Pin<Box<dyn Future<Output = Result<ChatResponse, SynapticError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Provided Methods§

Source

fn profile(&self) -> Option<ModelProfile>

Return the model’s capability profile, if known.

Source

fn stream_chat(&self, request: ChatRequest) -> ChatStream<'_>

Implementors§