pub trait MessageStore: Send + Sync {
// Required methods
fn append<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
message: Message,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_history<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn clear<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn replace_history<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
messages: Vec<Message>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided method
fn count<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
Trait for storing and retrieving conversation messages. Implement this trait to persist messages to your storage backend.
Required Methods§
Sourcefn append<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
message: Message,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn append<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
message: Message,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn get_history<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_history<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn clear<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn clear<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn replace_history<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
messages: Vec<Message>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn replace_history<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
messages: Vec<Message>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Replace the entire message history for a thread. Used for context compaction to replace old messages with a summary.
§Errors
Returns an error if the history cannot be replaced.