备注
Go to the end to download the full example code.
记忆¶
在 AgentScope 中,记忆(memory)用于存储智能体的上下文,并在需要时检索它。
具体而言,AgentScope 在 agentscope.memory
模块下提供了记忆基类 MemoryBase
和一个可直接使用的基于内存实现 InMemoryMemory
。
自定义记忆¶
要自定义您自己的记忆,只需继承 MemoryBase
并实现以下方法:
方法 |
描述 |
---|---|
|
向记忆中添加 |
|
从记忆中删除项目 |
|
记忆的大小 |
|
清空记忆内容 |
|
以 |
|
获取记忆的状态字典 |
|
加载记忆的状态字典 |
进一步阅读¶
Total running time of the script: (0 minutes 0.000 seconds)