MCPcopy Create free account
hub / github.com/InternScience/InternAgent / add_note

Method add_note

tasks/AutoMem/code/memory_layer.py:713–726  ·  view source on GitHub ↗

Add a new memory note

(self, content: str, time: str = None, **kwargs)

Source from the content-addressed store, hash-verified

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

Callers 2

run_testsFunction · 0.95
add_memoryMethod · 0.45

Calls 4

process_memoryMethod · 0.95
consolidate_memoriesMethod · 0.95
MemoryNoteClass · 0.70
add_documentsMethod · 0.45

Tested by

no test coverage detected