pub trait LlmProvider: Send + Sync {
// Required methods
fn generate<'life0, 'life1, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
) -> Pin<Box<dyn Future<Output = Result<Response, LlmError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn generate_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<ResponseChunk, LlmError>> + Send>>, LlmError>> + 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 = bool> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn name(&self) -> &str;
fn model(&self) -> &str;
fn list_models<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, LlmError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Trait for LLM providers.
Required Methods§
Sourcefn generate<'life0, 'life1, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
) -> Pin<Box<dyn Future<Output = Result<Response, LlmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn generate<'life0, 'life1, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
) -> Pin<Box<dyn Future<Output = Result<Response, LlmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Generate a complete response (non-streaming).
Sourcefn generate_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<ResponseChunk, LlmError>> + Send>>, LlmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn generate_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<ResponseChunk, LlmError>> + Send>>, LlmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Generate a streaming response.
Sourcefn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Check if the provider is available.
Sourcefn list_models<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, LlmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_models<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, LlmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List models available from this provider. Used by select_provider
to probe reachability and match preferred_models during startup.