pub struct SimpleConsolidationEngine { /* private fields */ }Expand description
Simple consolidation engine for fast batch processing
Implementations§
Source§impl SimpleConsolidationEngine
impl SimpleConsolidationEngine
pub fn new(config: SimpleConsolidationConfig) -> Self
Sourcepub fn calculate_recall_probability(
&self,
memory: &Memory,
cos_similarity: Option<f64>,
) -> Result<f64>
pub fn calculate_recall_probability( &self, memory: &Memory, cos_similarity: Option<f64>, ) -> Result<f64>
Calculate recall probability using Story 2 formula: P(recall) = r × exp(-g × t / (1 + n)) × cos_similarity
Sourcepub fn update_consolidation_strength(
&self,
current_strength: f64,
time_since_access_hours: f64,
) -> Result<f64>
pub fn update_consolidation_strength( &self, current_strength: f64, time_since_access_hours: f64, ) -> Result<f64>
Update consolidation strength using Story 2 formula: gn = gn-1 + (1 - e^-t)/(1 + e^-t)
Sourcepub fn process_memory_consolidation(
&self,
memory: &Memory,
cos_similarity: Option<f64>,
) -> Result<SimpleConsolidationResult>
pub fn process_memory_consolidation( &self, memory: &Memory, cos_similarity: Option<f64>, ) -> Result<SimpleConsolidationResult>
Process consolidation for a single memory
Sourcepub fn process_batch_consolidation(
&self,
memories: &[Memory],
similarities: Option<&[f64]>,
) -> Result<Vec<SimpleConsolidationResult>>
pub fn process_batch_consolidation( &self, memories: &[Memory], similarities: Option<&[f64]>, ) -> Result<Vec<SimpleConsolidationResult>>
Process consolidation for a batch of memories Target: Process 1000 memories in < 1 second
Sourcepub fn calculate_cosine_similarity(
&self,
vec1: &Vector,
vec2: &Vector,
) -> Result<f64>
pub fn calculate_cosine_similarity( &self, vec1: &Vector, vec2: &Vector, ) -> Result<f64>
Calculate cosine similarity between two vectors (helper function)
Sourcepub fn get_migration_candidates(
&self,
memories: &[Memory],
) -> Result<Vec<(usize, MemoryTier)>>
pub fn get_migration_candidates( &self, memories: &[Memory], ) -> Result<Vec<(usize, MemoryTier)>>
Get migration candidates based on recall probability threshold
Auto Trait Implementations§
impl Freeze for SimpleConsolidationEngine
impl RefUnwindSafe for SimpleConsolidationEngine
impl Send for SimpleConsolidationEngine
impl Sync for SimpleConsolidationEngine
impl Unpin for SimpleConsolidationEngine
impl UnwindSafe for SimpleConsolidationEngine
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