pub struct LongTermMemory { /* private fields */ }Expand description
Unbounded long-term memory with weighted-decay ranking.
Implementations§
Source§impl LongTermMemory
impl LongTermMemory
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a store with default DecayWeights and LexicalScorer.
Sourcepub fn with_config(
weights: DecayWeights,
scorer: Arc<dyn SemanticScorer>,
) -> Self
pub fn with_config( weights: DecayWeights, scorer: Arc<dyn SemanticScorer>, ) -> Self
Creates a store with explicit weights and scorer.
Sourcepub fn weights(&self) -> &DecayWeights
pub fn weights(&self) -> &DecayWeights
Ranking configuration.
Trait Implementations§
Source§impl Debug for LongTermMemory
impl Debug for LongTermMemory
Source§impl Default for LongTermMemory
impl Default for LongTermMemory
Source§impl MemoryStore for LongTermMemory
impl MemoryStore for LongTermMemory
Source§fn put<'life0, 'life1, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
item: MemoryItem,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn put<'life0, 'life1, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
item: MemoryItem,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Writes/updates an item in the namespace. Re-putting an existing key refreshes
its content and access time.
Source§fn get<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<MemoryItem>, MemoryError>> + 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,
namespace: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<MemoryItem>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Exact key lookup (
None when absent). Counts as an access.Source§fn search<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query: &'life1 MemoryQuery<'life2>,
) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryHit>, MemoryError>> + 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,
query: &'life1 MemoryQuery<'life2>,
) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryHit>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Semantic recall, best score first, capped at
query.k.Source§fn forget<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<bool, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn forget<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<bool, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Removes one entry; returns whether it existed.
Source§fn clear_namespace<'life0, 'life1, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<usize, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn clear_namespace<'life0, 'life1, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<usize, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Drops every entry in the namespace; returns the number removed.
Auto Trait Implementations§
impl !Freeze for LongTermMemory
impl !RefUnwindSafe for LongTermMemory
impl !UnwindSafe for LongTermMemory
impl Send for LongTermMemory
impl Sync for LongTermMemory
impl Unpin for LongTermMemory
impl UnsafeUnpin for LongTermMemory
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