pub trait ChatProvider: Sync + Send {
// Required method
fn chat_with_tools<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
messages: &'life1 [ChatMessage],
tools: Option<&'life2 [Tool]>,
json_schema: Option<StructuredOutputFormat>,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn ChatResponse>, LLMError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
// Provided methods
fn chat<'life0, 'life1, 'async_trait>(
&'life0 self,
messages: &'life1 [ChatMessage],
json_schema: Option<StructuredOutputFormat>,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn ChatResponse>, LLMError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn chat_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
_messages: &'life1 [ChatMessage],
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<String, LLMError>> + Send>>, LLMError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn memory_contents<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<Vec<ChatMessage>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn summarize_history<'life0, 'life1, 'async_trait>(
&'life0 self,
msgs: &'life1 [ChatMessage],
) -> Pin<Box<dyn Future<Output = Result<String, LLMError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}
Expand description
Trait for providers that support chat-style interactions.
Required Methods§
Sourcefn chat_with_tools<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
messages: &'life1 [ChatMessage],
tools: Option<&'life2 [Tool]>,
json_schema: Option<StructuredOutputFormat>,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn ChatResponse>, LLMError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn chat_with_tools<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
messages: &'life1 [ChatMessage],
tools: Option<&'life2 [Tool]>,
json_schema: Option<StructuredOutputFormat>,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn ChatResponse>, LLMError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Provided Methods§
Sourcefn chat<'life0, 'life1, 'async_trait>(
&'life0 self,
messages: &'life1 [ChatMessage],
json_schema: Option<StructuredOutputFormat>,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn ChatResponse>, LLMError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn chat<'life0, 'life1, 'async_trait>(
&'life0 self,
messages: &'life1 [ChatMessage],
json_schema: Option<StructuredOutputFormat>,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn ChatResponse>, LLMError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn chat_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
_messages: &'life1 [ChatMessage],
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<String, LLMError>> + Send>>, LLMError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn chat_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
_messages: &'life1 [ChatMessage],
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<String, LLMError>> + Send>>, LLMError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn memory_contents<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<Vec<ChatMessage>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn memory_contents<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<Vec<ChatMessage>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get current memory contents if provider supports memory