pub struct ColdStore { /* private fields */ }Expand description
Unbounded long-term memory archive. Entries are never deleted.
recall returns top-N entries by a blended score of reward × recency.
§Examples
use lmm_agent::cognition::memory::{ColdStore, MemoryEntry};
let mut cold = ColdStore::default();
cold.promote(MemoryEntry::new("fact about Rust".into(), 0.9, 0));
assert_eq!(cold.len(), 1);
let recalled = cold.recall("Rust", 1);
assert_eq!(recalled[0].content, "fact about Rust");Implementations§
Source§impl ColdStore
impl ColdStore
Sourcepub fn promote(&mut self, entry: MemoryEntry)
pub fn promote(&mut self, entry: MemoryEntry)
Appends an entry to the archive.
Sourcepub fn all(&self) -> &[MemoryEntry]
pub fn all(&self) -> &[MemoryEntry]
Returns all archived entries (insertion order).
Sourcepub fn recall(&self, query: &str, top_n: usize) -> Vec<&MemoryEntry>
pub fn recall(&self, query: &str, top_n: usize) -> Vec<&MemoryEntry>
Returns the top-n entries most relevant to query, blending
token-overlap with a recency factor.
§Examples
use lmm_agent::cognition::memory::{ColdStore, MemoryEntry};
let mut cold = ColdStore::default();
cold.promote(MemoryEntry::new("old fact".into(), 0.5, 0));
cold.promote(MemoryEntry::new("Rust ownership facts recent".into(), 0.8, 5));
let top = cold.recall("Rust", 1);
assert_eq!(top[0].content, "Rust ownership facts recent");Trait Implementations§
Auto Trait Implementations§
impl Freeze for ColdStore
impl RefUnwindSafe for ColdStore
impl Send for ColdStore
impl Sync for ColdStore
impl Unpin for ColdStore
impl UnsafeUnpin for ColdStore
impl UnwindSafe for ColdStore
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