Skip to main content

ChatModel

Trait ChatModel 

Source
pub trait ChatModel:
    Send
    + Sync
    + Debug {
    // Required method
    fn chat(
        &self,
        request: ChatRequest,
    ) -> BoxFuture<'_, Result<ChatStream, LlmError>>;

    // Provided method
    fn default_max_tokens(&self) -> Option<u32> { ... }
}
Expand description

A chat-capable model endpoint.

Required Methods§

Source

fn chat( &self, request: ChatRequest, ) -> BoxFuture<'_, Result<ChatStream, LlmError>>

Start a streaming chat completion.

Provided Methods§

Source

fn default_max_tokens(&self) -> Option<u32>

The output limit this model sends when a request sets none (a providers file’s defaults.max_tokens), so a node can tell whether the run’s budget or this default limits its call.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§