pub struct LongTermMemory { /* private fields */ }Expand description
Long-term memory with semantic search
Implementations§
Source§impl LongTermMemory
impl LongTermMemory
pub fn new(capacity: usize, similarity_threshold: f32) -> Self
Sourcepub fn store(
&self,
content: impl Into<String>,
embedding: Vec<f32>,
source: MemorySource,
) -> String
pub fn store( &self, content: impl Into<String>, embedding: Vec<f32>, source: MemorySource, ) -> String
Store a memory with its embedding
Sourcepub fn store_item(&self, item: MemoryItem, embedding: Vec<f32>) -> String
pub fn store_item(&self, item: MemoryItem, embedding: Vec<f32>) -> String
Store a memory item with embedding
Sourcepub fn search(
&self,
query_embedding: &[f32],
limit: usize,
) -> Vec<(MemoryItem, f32)>
pub fn search( &self, query_embedding: &[f32], limit: usize, ) -> Vec<(MemoryItem, f32)>
Search for similar memories using embedding
Sourcepub fn get_all(&self) -> Vec<LongTermEntry>
pub fn get_all(&self) -> Vec<LongTermEntry>
Get all entries (for export/debugging)
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn get_important(&self, min_importance: f32) -> Vec<MemoryItem>
pub fn get_important(&self, min_importance: f32) -> Vec<MemoryItem>
Get memories by importance threshold
Auto Trait Implementations§
impl !Freeze for LongTermMemory
impl !RefUnwindSafe for LongTermMemory
impl Send for LongTermMemory
impl Sync for LongTermMemory
impl Unpin for LongTermMemory
impl UnsafeUnpin for LongTermMemory
impl UnwindSafe 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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more