Skip to main content

LlmProvider

Trait LlmProvider 

Source
pub trait LlmProvider: Send + Sync {
    // Required methods
    fn chat_stream(
        &self,
        messages: &[Message],
        tools: Option<&[ToolDef]>,
    ) -> Result<Pin<Box<dyn Stream<Item = Result<StreamEvent>> + Send>>>;
    fn model_name(&self) -> &str;

    // Provided methods
    fn availability_error(&self) -> Option<&str> { ... }
    fn reasoning_history_policy(&self) -> ReasoningPolicy { ... }
}

Required Methods§

Source

fn chat_stream( &self, messages: &[Message], tools: Option<&[ToolDef]>, ) -> Result<Pin<Box<dyn Stream<Item = Result<StreamEvent>> + Send>>>

Source

fn model_name(&self) -> &str

Provided Methods§

Source

fn availability_error(&self) -> Option<&str>

Source

fn reasoning_history_policy(&self) -> ReasoningPolicy

Whether historical reasoning_content should be echoed back to the provider on subsequent requests. Default Exclude (safe for all providers that don’t demand it). Providers that hit a thinking-model API should override.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§