Skip to main content

abu_agent/memory/
mod.rs

1mod sequential;
2mod slidingwindow;
3mod summary;
4mod retrieval;
5mod augmented;
6#[cfg(test)]
7mod test;
8
9use abu_base::chat::ChatMessage;
10pub use sequential::SequentialMemory;
11pub use slidingwindow::SliceWindowMemory;
12pub use summary::SummarizationMemory;
13pub use retrieval::RetrievalMemory;
14pub use augmented::AugmentedMemory;
15
16#[allow(async_fn_in_trait)]
17pub trait Memory : Send + Sync {
18    type Error: std::error::Error + 'static;
19
20    async fn add(&mut self, user_input: &str, ai_response: &str) -> Result<(), Self::Error>;
21    async fn search(&self, query: &str) -> Result<Vec<ChatMessage>, Self::Error>;
22    async fn clear(&mut self) -> Result<(), Self::Error>;
23}