Skip to main content

LlmProvider

Trait LlmProvider 

Source
pub trait LlmProvider: Send + Sync {
    // Required methods
    fn generate<'life0, 'async_trait>(
        &'life0 self,
        req: LlmRequest,
    ) -> Pin<Box<dyn Future<Output = Result<LlmResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn name(&self) -> &str;
    fn supports_model(&self, model: &str) -> bool;
}
Expand description

Trait for LLM providers (Anthropic, OpenAI, Ollama, etc.)

Required Methods§

Source

fn generate<'life0, 'async_trait>( &'life0 self, req: LlmRequest, ) -> Pin<Box<dyn Future<Output = Result<LlmResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Generate a response (non-streaming)

Source

fn name(&self) -> &str

Provider name for routing/logging

Source

fn supports_model(&self, model: &str) -> bool

Models supported by this provider (prefix matching)

Implementors§