pub trait MessageHistory:
Send
+ Sync
+ Debug {
// Required methods
fn history<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ChatMessage>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn push_owned<'life0, 'async_trait>(
&'life0 self,
item: ChatMessage,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn overwrite<'life0, 'async_trait>(
&'life0 self,
items: Vec<ChatMessage>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn push<'life0, 'life1, 'async_trait>(
&'life0 self,
item: &'life1 ChatMessage,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn extend<'life0, 'life1, 'async_trait>(
&'life0 self,
items: &'life1 [ChatMessage],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn extend_owned<'life0, 'async_trait>(
&'life0 self,
items: Vec<ChatMessage>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}
Expand description
A backend for the agent context. A default is provided for Arc<Mutex<Vec
If you want to use for instance a database, implement this trait and pass it to the agent context when creating it.
Required Methods§
Sourcefn history<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ChatMessage>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn history<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ChatMessage>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the history of messages
Sourcefn push_owned<'life0, 'async_trait>(
&'life0 self,
item: ChatMessage,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn push_owned<'life0, 'async_trait>(
&'life0 self,
item: ChatMessage,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Add a message to the history
Provided Methods§
Sourcefn push<'life0, 'life1, 'async_trait>(
&'life0 self,
item: &'life1 ChatMessage,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn push<'life0, 'life1, 'async_trait>(
&'life0 self,
item: &'life1 ChatMessage,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Add a message to the history
Sourcefn extend<'life0, 'life1, 'async_trait>(
&'life0 self,
items: &'life1 [ChatMessage],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn extend<'life0, 'life1, 'async_trait>(
&'life0 self,
items: &'life1 [ChatMessage],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Extend the history with the given items
Sourcefn extend_owned<'life0, 'async_trait>(
&'life0 self,
items: Vec<ChatMessage>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn extend_owned<'life0, 'async_trait>(
&'life0 self,
items: Vec<ChatMessage>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Extend the history with the given items, taking ownership of them