Add a new memory note
(self, content: str, time: str = None, **kwargs)
| 711 | self.evo_threshold = evo_threshold |
| 712 | |
| 713 | def add_note(self, content: str, time: str = None, **kwargs) -> str: |
| 714 | """Add a new memory note""" |
| 715 | note = MemoryNote(content=content, llm_controller=self.llm_controller, timestamp=time, **kwargs) |
| 716 | |
| 717 | # Update retriever with all documents |
| 718 | # all_docs = [m.content for m in self.memories.values()] |
| 719 | evo_label, note = self.process_memory(note) |
| 720 | self.memories[note.id] = note |
| 721 | self.retriever.add_documents(["content:" + note.content + " context:" + note.context + " keywords: " + ", ".join(note.keywords) + " tags: " + ", ".join(note.tags)]) |
| 722 | if evo_label == True: |
| 723 | self.evo_cnt += 1 |
| 724 | if self.evo_cnt % self.evo_threshold == 0: |
| 725 | self.consolidate_memories() |
| 726 | return note.id |
| 727 | |
| 728 | def consolidate_memories(self): |
| 729 | """Consolidate memories: update retriever with new documents |
no test coverage detected