pub struct InMemoryMemoryStore { /* private fields */ }Expand description
InMemoryMemoryStore — a lightweight MemoryStore backed by per-agent in-memory maps.
Rust port of node/src/memory/in-memory-store.ts. Use for benchmarks, unit tests, and local
development where persistent memory isn’t needed. search() is a deterministic reference
ranker: distinct lexical overlap first, metadata recency second, insertion order last.
Implementations§
Source§impl InMemoryMemoryStore
impl InMemoryMemoryStore
pub fn new() -> Self
pub fn with_initial_memories(initial: Vec<MemoryRecord>) -> Self
pub fn saved_sessions(&self) -> Vec<SessionData>
Trait Implementations§
Source§impl Default for InMemoryMemoryStore
impl Default for InMemoryMemoryStore
Source§impl MemoryStore for InMemoryMemoryStore
impl MemoryStore for InMemoryMemoryStore
fn put<'life0, 'life1, 'async_trait>(
&'life0 self,
agent_id: &'life1 str,
incoming: MemoryRecord,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn get<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
agent_id: &'life1 str,
record_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<MemoryRecord>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
agent_id: &'life1 str,
record_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<MemoryRecord>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Return one record by its agent-local id, or
None when it does not exist.Source§fn delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
agent_id: &'life1 str,
record_id: &'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 delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
agent_id: &'life1 str,
record_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Delete one record by its agent-local id. Missing records are a successful no-op.
Source§fn search<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
agent_id: &'life1 str,
query: &'life2 MemoryQuery,
) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryRecall>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn search<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
agent_id: &'life1 str,
query: &'life2 MemoryQuery,
) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryRecall>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Semantic search over the agent’s long-term memories.
Called on demand during a session when the LLM invokes the
memory meta-tool.Source§fn save_session<'life0, 'async_trait>(
&'life0 self,
data: SessionData,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn save_session<'life0, 'async_trait>(
&'life0 self,
data: SessionData,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Persist a completed session before the runner’s one extraction pass.
Auto Trait Implementations§
impl !Freeze for InMemoryMemoryStore
impl RefUnwindSafe for InMemoryMemoryStore
impl Send for InMemoryMemoryStore
impl Sync for InMemoryMemoryStore
impl Unpin for InMemoryMemoryStore
impl UnsafeUnpin for InMemoryMemoryStore
impl UnwindSafe for InMemoryMemoryStore
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