Store a memory in long-term storage and add to short-term
(&self, item: MemoryItem)
| 147 | |
| 148 | /// Store a memory in long-term storage and add to short-term |
| 149 | pub async fn remember(&self, item: MemoryItem) -> anyhow::Result<()> { |
| 150 | self.store.store(item.clone()).await?; |
| 151 | let mut short_term = self.short_term.write().await; |
| 152 | short_term.push_back(item); |
| 153 | if short_term.len() > self.max_short_term { |
| 154 | short_term.pop_front(); |
| 155 | } |
| 156 | Ok(()) |
| 157 | } |
| 158 | |
| 159 | /// Remember a successful pattern |
| 160 | pub async fn remember_success( |