pub trait ChatModel: Send + Sync {
// Required method
fn chat<'life0, 'async_trait>(
&'life0 self,
request: ChatRequest,
) -> Pin<Box<dyn Future<Output = Result<ChatResponse, SynapticError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
// Provided methods
fn profile(&self) -> Option<ModelProfile> { ... }
fn stream_chat(
&self,
request: ChatRequest,
) -> Pin<Box<dyn Stream<Item = Result<AIMessageChunk, SynapticError>> + Send + '_>> { ... }
}Expand description
The core trait for language model providers. Implementations provide chat() for single responses and optionally stream_chat() for streaming.
Required Methods§
fn chat<'life0, 'async_trait>(
&'life0 self,
request: ChatRequest,
) -> Pin<Box<dyn Future<Output = Result<ChatResponse, SynapticError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Provided Methods§
Sourcefn profile(&self) -> Option<ModelProfile>
fn profile(&self) -> Option<ModelProfile>
Return the model’s capability profile, if known.