ChatProvider

Trait ChatProvider 

Source
pub trait ChatProvider: Send + Sync {
    type Config: ProviderConfig;
    type Response: ChatResponse;
    type Error: ProviderError;

    // Required method
    fn chat<'life0, 'async_trait>(
        &'life0 self,
        request: ChatRequest,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
}
Expand description

Base trait for chat-based LLM providers.

This trait defines the core chat functionality that most LLM providers support. Providers implement this trait to provide conversational AI capabilities.

Required Associated Types§

Source

type Config: ProviderConfig

Provider-specific configuration type

Source

type Response: ChatResponse

Provider-specific response type

Source

type Error: ProviderError

Provider-specific error type

Required Methods§

Source

fn chat<'life0, 'async_trait>( &'life0 self, request: ChatRequest, ) -> Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Send a chat request and receive a response.

§Arguments
  • request - The chat request containing messages and parameters
§Returns

A result containing the provider’s response or an error

Implementors§