1use async_trait::async_trait;
2use serde_json::Value;
3use std::collections::HashMap;
4use wesichain_core::WesichainError;
5
6pub mod buffer;
7mod buffer_tests;
8pub mod semantic;
9pub mod summary;
10mod summary_tests;
11pub mod window;
12mod window_tests;
13
14pub use semantic::{EntityMemory, MemoryRouter, VectorMemoryStore};
15
16#[async_trait]
17pub trait Memory: Send + Sync {
18 async fn load_memory_variables(
20 &self,
21 thread_id: &str,
22 ) -> Result<HashMap<String, Value>, WesichainError>;
23
24 async fn save_context(
26 &self,
27 thread_id: &str,
28 inputs: &HashMap<String, Value>,
29 outputs: &HashMap<String, Value>,
30 ) -> Result<(), WesichainError>;
31
32 async fn clear(&self, thread_id: &str) -> Result<(), WesichainError>;
34}