pub struct MemoryEngine { /* private fields */ }Expand description
The core memory engine. Orchestrates the full add/search/get/update/delete/history pipeline.
Implementations§
Source§impl MemoryEngine
impl MemoryEngine
pub async fn new(config: MemoryEngineConfig) -> Result<Self>
Sourcepub async fn add(
&self,
messages: &[ChatMessage],
user_id: Option<&str>,
agent_id: Option<&str>,
run_id: Option<&str>,
) -> Result<AddResult>
pub async fn add( &self, messages: &[ChatMessage], user_id: Option<&str>, agent_id: Option<&str>, run_id: Option<&str>, ) -> Result<AddResult>
Add memories from a conversation. Extracts facts, deduplicates, and stores.
Sourcepub async fn search(
&self,
query: &str,
user_id: Option<&str>,
agent_id: Option<&str>,
run_id: Option<&str>,
limit: usize,
) -> Result<SearchResult>
pub async fn search( &self, query: &str, user_id: Option<&str>, agent_id: Option<&str>, run_id: Option<&str>, limit: usize, ) -> Result<SearchResult>
Search memories by semantic similarity.
Sourcepub async fn get(&self, memory_id: Uuid) -> Result<MemoryItem>
pub async fn get(&self, memory_id: Uuid) -> Result<MemoryItem>
Get a single memory by ID.
Sourcepub async fn get_all(
&self,
user_id: Option<&str>,
agent_id: Option<&str>,
run_id: Option<&str>,
) -> Result<Vec<MemoryItem>>
pub async fn get_all( &self, user_id: Option<&str>, agent_id: Option<&str>, run_id: Option<&str>, ) -> Result<Vec<MemoryItem>>
List all memories matching the given filters.
Sourcepub async fn update(&self, memory_id: Uuid, new_text: &str) -> Result<()>
pub async fn update(&self, memory_id: Uuid, new_text: &str) -> Result<()>
Update a memory’s text directly.
Sourcepub async fn delete_all(
&self,
user_id: Option<&str>,
agent_id: Option<&str>,
run_id: Option<&str>,
) -> Result<()>
pub async fn delete_all( &self, user_id: Option<&str>, agent_id: Option<&str>, run_id: Option<&str>, ) -> Result<()>
Delete all memories matching the given filters.
Auto Trait Implementations§
impl Freeze for MemoryEngine
impl !RefUnwindSafe for MemoryEngine
impl Send for MemoryEngine
impl Sync for MemoryEngine
impl Unpin for MemoryEngine
impl UnsafeUnpin for MemoryEngine
impl !UnwindSafe for MemoryEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more