Skip to main content

LLMProvider

Trait LLMProvider 

Source
pub trait LLMProvider: Send + Sync {
    // Required methods
    fn complete<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        messages: Vec<Message>,
        options: &'life1 CompletionOptions,
        client: &'life2 Client,
    ) -> Pin<Box<dyn Future<Output = AgentResult<CompletionResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn provider_name(&self) -> &'static str;
    fn is_configured(&self) -> bool;
}
Expand description

LLM provider trait for abstracting different LLM APIs.

Required Methods§

Source

fn complete<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, messages: Vec<Message>, options: &'life1 CompletionOptions, client: &'life2 Client, ) -> Pin<Box<dyn Future<Output = AgentResult<CompletionResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Send a completion request and return the response text.

Source

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

Provider name for logging/debugging.

Source

fn is_configured(&self) -> bool

Check if the provider is properly configured.

Implementors§