(&self, item: &MemoryItem, now: DateTime<Utc>)
| 139 | } |
| 140 | |
| 141 | pub(crate) fn score(&self, item: &MemoryItem, now: DateTime<Utc>) -> f32 { |
| 142 | let age_days = (now - item.timestamp).num_seconds() as f32 / 86400.0; |
| 143 | let decay = (-age_days / self.relevance_config.decay_days).exp(); |
| 144 | item.importance * self.relevance_config.importance_weight |
| 145 | + decay * self.relevance_config.recency_weight |
| 146 | } |
| 147 | |
| 148 | /// Store a memory in long-term storage and add to short-term |
| 149 | pub async fn remember(&self, item: MemoryItem) -> anyhow::Result<()> { |
no outgoing calls