Skip to main content

LlmProvider

Trait LlmProvider 

Source
pub trait LlmProvider: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn display_name(&self) -> &'static str;
    fn capabilities(&self) -> LlmCapabilities;
    fn default_model(&self) -> &str;
    fn available_models(&self) -> &[String];
    fn complete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: &'life1 ChatRequest,
    ) -> Pin<Box<dyn Future<Output = Result<ChatResponse, RunnerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn complete_stream<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: &'life1 ChatRequest,
    ) -> Pin<Box<dyn Future<Output = Result<ChatStream, RunnerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn health_check<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<bool, RunnerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

LLM provider trait for chat completion

Implement this trait to add a new LLM runner. Each runner wraps a CLI tool and translates between the chat protocol and the tool’s native interface.

Required Methods§

Source

fn name(&self) -> &'static str

Unique provider identifier (e.g., claude_code, copilot)

Source

fn display_name(&self) -> &'static str

Human-readable display name for the provider

Source

fn capabilities(&self) -> LlmCapabilities

Provider capabilities (streaming, function calling, etc.)

Source

fn default_model(&self) -> &str

Default model to use if not specified in request

Source

fn available_models(&self) -> &[String]

Available models for this provider

Source

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

Perform a chat completion (non-streaming)

Source

fn complete_stream<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 ChatRequest, ) -> Pin<Box<dyn Future<Output = Result<ChatStream, RunnerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Perform a streaming chat completion

Returns a stream of chunks that can be consumed incrementally. Falls back to non-streaming if not supported.

Source

fn health_check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool, RunnerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Check if the provider is healthy and ready to serve requests

Implementors§