pub trait Model: Send + Sync {
// Required methods
fn chat<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 mut self,
messages: &'life1 [ChatMessage],
context: &'life2 ProjectContext,
config: &'life3 ModelConfig,
stream_callback: Option<StreamCallback>,
) -> Pin<Box<dyn Future<Output = Result<ModelResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn name(&self) -> &str;
fn is_local(&self) -> bool;
// Provided method
fn validate_connection<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Core trait that all model implementations must provide
This is the public API. Internal backends implement this via UnifiedModel wrapper.
Required Methods§
Sourcefn chat<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 mut self,
messages: &'life1 [ChatMessage],
context: &'life2 ProjectContext,
config: &'life3 ModelConfig,
stream_callback: Option<StreamCallback>,
) -> Pin<Box<dyn Future<Output = Result<ModelResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn chat<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 mut self,
messages: &'life1 [ChatMessage],
context: &'life2 ProjectContext,
config: &'life3 ModelConfig,
stream_callback: Option<StreamCallback>,
) -> Pin<Box<dyn Future<Output = Result<ModelResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Send a chat conversation to the model and get a response