pub struct ReflectionTracker { /* private fields */ }Expand description
Tracks cumulative importance of stored memories to trigger reflection.
When the sum of importance values since the last trigger exceeds threshold,
record() returns true and resets the accumulator. This follows the
Generative Agents (Park et al., 2023) reflection pattern.
Implementations§
Source§impl ReflectionTracker
impl ReflectionTracker
pub fn new(threshold: u32) -> Self
Sourcepub fn record(&self, importance: u8) -> bool
pub fn record(&self, importance: u8) -> bool
Record an importance value. Returns true if the threshold was exceeded,
triggering a reflection. The accumulator is reset after triggering.
Sourcepub fn accumulated(&self) -> u32
pub fn accumulated(&self) -> u32
Current accumulated importance (for testing/debugging).
Auto Trait Implementations§
impl !Freeze for ReflectionTracker
impl !RefUnwindSafe for ReflectionTracker
impl Send for ReflectionTracker
impl Sync for ReflectionTracker
impl Unpin for ReflectionTracker
impl UnsafeUnpin for ReflectionTracker
impl UnwindSafe for ReflectionTracker
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