github链接:https://github.com/MSzgy/LLMs-as-Operating-Systems-Agent-Memory
Introduction
本课程讲解了MemGPT论文,主要研究了如何对Memory做处理,解决context window不够的pain point,理论上可以做到无限上下文长度。
Reference:
Agent Framework: https://docs.letta.com/agent-development-environment
"Letta’s context management system solves this by intelligently managing what information your agent has access to - from its long-term memories to external data sources. This enables agents to maintain consistent behavior across days or even months of interactions, while automatically incorporating relevant information from large external data sources."
Editable Memory
在代码中,实现了一个简单的工具,可以更新 chat的memory。
Understanding MemGPT
在MemGPT背后有如下几个核心点:
可以自我更新的memory
内部思考 chain of thoughts
每个输出都会调用工具
Chat history
下图说明了在chat过程中,historical chat如何处理的问题,由于context window是有限的,所以不得不得更新一些新的memory在当前chat中,但是对于旧的chat memory信息,则会持久化到数据库中,这里在图中被称为recall memory,这是MemGPT与其他框架的不同之处(也许其他框架也有,这里只是王婆卖瓜,自卖自夸)。
Core memory
在core memory 这一部分,与chat history部分类似,会将暂时不用的memory信息称为archival memory并持久化。
Building Agents with Memory
see code