pub struct RecencyConfig {
pub lambda: f32,
}Expand description
Parameters for exponential time-decay of memory recency.
The decay formula is: recency_weight = exp(-lambda * days_since_access)
Common presets:
| Half-life | lambda |
|---|---|
| 1 day | 0.693 |
| 1 week | 0.099 |
| 1 month | 0.023 |
| 3 months | 0.0077 |
Fields§
§lambda: f32Decay rate λ. Must be > 0. Typical range: 0.005–1.0.
Implementations§
Source§impl RecencyConfig
impl RecencyConfig
Sourcepub const WEEKLY_DECAY: Self
pub const WEEKLY_DECAY: Self
λ ≈ ln(2)/7 — half-life of 7 days. Good default for conversational agents.
Sourcepub const MONTHLY_DECAY: Self
pub const MONTHLY_DECAY: Self
λ ≈ ln(2)/30 — half-life of 30 days. Good for long-term knowledge bases.
Sourcepub const DAILY_DECAY: Self
pub const DAILY_DECAY: Self
λ ≈ ln(2)/1 — half-life of 1 day. Aggressive decay for short-term sessions.
pub fn new(lambda: f32) -> Self
Trait Implementations§
Source§impl Clone for RecencyConfig
impl Clone for RecencyConfig
Source§fn clone(&self) -> RecencyConfig
fn clone(&self) -> RecencyConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for RecencyConfig
Source§impl Debug for RecencyConfig
impl Debug for RecencyConfig
Source§impl Default for RecencyConfig
impl Default for RecencyConfig
Source§impl<'de> Deserialize<'de> for RecencyConfig
impl<'de> Deserialize<'de> for RecencyConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for RecencyConfig
impl RefUnwindSafe for RecencyConfig
impl Send for RecencyConfig
impl Sync for RecencyConfig
impl Unpin for RecencyConfig
impl UnsafeUnpin for RecencyConfig
impl UnwindSafe for RecencyConfig
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