pub trait LLMProvider: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn provider_type(&self) -> Provider;
fn supported_models(&self) -> Vec<String>;
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = RsllmResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn chat_completion<'life0, 'life1, 'async_trait>(
&'life0 self,
messages: Vec<ChatMessage>,
model: Option<&'life1 str>,
temperature: Option<f32>,
max_tokens: Option<u32>,
) -> Pin<Box<dyn Future<Output = RsllmResult<ChatResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn chat_completion_stream<'life0, 'async_trait>(
&'life0 self,
messages: Vec<ChatMessage>,
model: Option<String>,
temperature: Option<f32>,
max_tokens: Option<u32>,
) -> Pin<Box<dyn Future<Output = RsllmResult<Box<dyn Stream<Item = RsllmResult<StreamChunk>> + Send + Unpin>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Core provider trait for LLM interactions
Required Methods§
Sourcefn provider_type(&self) -> Provider
fn provider_type(&self) -> Provider
Provider type
Sourcefn supported_models(&self) -> Vec<String>
fn supported_models(&self) -> Vec<String>
Supported models
Sourcefn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = RsllmResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = RsllmResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Health check
Sourcefn chat_completion<'life0, 'life1, 'async_trait>(
&'life0 self,
messages: Vec<ChatMessage>,
model: Option<&'life1 str>,
temperature: Option<f32>,
max_tokens: Option<u32>,
) -> Pin<Box<dyn Future<Output = RsllmResult<ChatResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn chat_completion<'life0, 'life1, 'async_trait>(
&'life0 self,
messages: Vec<ChatMessage>,
model: Option<&'life1 str>,
temperature: Option<f32>,
max_tokens: Option<u32>,
) -> Pin<Box<dyn Future<Output = RsllmResult<ChatResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Chat completion (non-streaming)
Sourcefn chat_completion_stream<'life0, 'async_trait>(
&'life0 self,
messages: Vec<ChatMessage>,
model: Option<String>,
temperature: Option<f32>,
max_tokens: Option<u32>,
) -> Pin<Box<dyn Future<Output = RsllmResult<Box<dyn Stream<Item = RsllmResult<StreamChunk>> + Send + Unpin>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn chat_completion_stream<'life0, 'async_trait>(
&'life0 self,
messages: Vec<ChatMessage>,
model: Option<String>,
temperature: Option<f32>,
max_tokens: Option<u32>,
) -> Pin<Box<dyn Future<Output = RsllmResult<Box<dyn Stream<Item = RsllmResult<StreamChunk>> + Send + Unpin>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Chat completion (streaming)