pub trait Memory: Send + Sync {
// Required methods
fn store<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
message: Message,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn retrieve<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
limit: usize,
) -> Pin<Box<dyn Future<Output = Vec<Message>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn clear<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn undo<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Option<Message>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
// Provided methods
fn store_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
messages: Vec<Message>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn search<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
query: &'life3 str,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Document>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn store_knowledge<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
title: &'life3 str,
content: &'life4 str,
collection: &'life5 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait { ... }
fn update_summary<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
collection: &'life1 str,
path: &'life2 str,
summary: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn link_scheduler(&self, _scheduler: Weak<Scheduler>) { ... }
fn fetch_document<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
path: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Document>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn store_session<'life0, 'async_trait>(
&'life0 self,
_session: AgentSession,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn retrieve_session<'life0, 'life1, 'async_trait>(
&'life0 self,
_session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<AgentSession>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
Trait for memory implementations
Required Methods§
Sourcefn store<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
message: Message,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn store<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
message: Message,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Store a message
Sourcefn retrieve<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
limit: usize,
) -> Pin<Box<dyn Future<Output = Vec<Message>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn retrieve<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
limit: usize,
) -> Pin<Box<dyn Future<Output = Vec<Message>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Retrieve recent messages
Sourcefn clear<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn clear<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Clear memory for a user
Sourcefn undo<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Option<Message>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn undo<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Option<Message>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Undo last message
Provided Methods§
Sourcefn store_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
messages: Vec<Message>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn store_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
messages: Vec<Message>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Store multiple messages efficiently
Sourcefn search<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
query: &'life3 str,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Document>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn search<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
query: &'life3 str,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Document>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Search the memory for relevant content
Sourcefn store_knowledge<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
title: &'life3 str,
content: &'life4 str,
collection: &'life5 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
fn store_knowledge<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
agent_id: Option<&'life2 str>,
title: &'life3 str,
content: &'life4 str,
collection: &'life5 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
Store a specific piece of knowledge (not just a message)
Sourcefn update_summary<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
collection: &'life1 str,
path: &'life2 str,
summary: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn update_summary<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
collection: &'life1 str,
path: &'life2 str,
summary: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Update summary for a piece of knowledge
Sourcefn link_scheduler(&self, _scheduler: Weak<Scheduler>)
fn link_scheduler(&self, _scheduler: Weak<Scheduler>)
Link a scheduler for background tasks
Sourcefn fetch_document<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
path: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Document>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn fetch_document<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
path: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Document>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Fetch a full document by path
Sourcefn store_session<'life0, 'async_trait>(
&'life0 self,
_session: AgentSession,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn store_session<'life0, 'async_trait>(
&'life0 self,
_session: AgentSession,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Store an agent session state
Sourcefn retrieve_session<'life0, 'life1, 'async_trait>(
&'life0 self,
_session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<AgentSession>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn retrieve_session<'life0, 'life1, 'async_trait>(
&'life0 self,
_session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<AgentSession>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieve an agent session state