[问题/Issue] 章节8:运行chapter8/09_Memory_Types_Deep_Dive.py的demonstrate_episodic_memory方法检索不出记忆数据
documentation
### 1. 遇到问题的章节 / Affected Chapter
chapter8/09_Memory_Types_Deep_Dive.py
### 2. 问题类型 / Issue Type
代码错误 / Code Error
### 3. 具体问题描述 / Problem Description
- demonstrate_episodic_memory方法运行时出现:**WARNING:hello_agents.memory.manager:检索 episodic 记忆时出错: 'str' object has no attribute 'get'**
<img width="2132" height="488" alt="Image" src="https://github.com/user-attachments/assets/a7a7c5a9-f95d-47c5-bf86-16c3abb53253" />
- episodic.py 的 retrieve 方法
<img width="1878" height="916" alt="Image" src="https://github.com/user-attachments/assets/137ed3d7-da42-4012-aaa9-8a9b1345293f" />
- 使用的版本是`pip install "hello-agents[all]==0.2.0"`
### 4. 问题重现材料 / Reproduction Materials
代码地址:https://github.com/datawhalechina/hello-agents/blob/main/code/chapter8/09_Memory_Types_Deep_Dive.py
原测试数据的context为字符串类型,导致运行报错
<img width="1328" height="1206" alt="Image" src="https://github.com/user-attachments/assets/88d2b93b-ac4a-4333-b149-ab5222d3c159" />
### 5. 补充信息 / Additional Information
将context字段格式修改后可以解决
```python
learning_session = [ {
"content": "开始学习Python机器学习",
"context": {"step": "学习开始"},
"location": "家里书房",
"mood": "专注",
"importance": 0.7
},
....]
```
### 确认事项 / Verification
- [x] 我已阅读过相关章节的文档 / I have read the relevant chapter documentation
- [x] 我已搜索过现有的Issues,确认此问题未被报告 / I have searched existing Issues and confirmed this hasn't been reported
- [ ] 我已尝试过基本的故障排除(如重启、重新安装依赖等) / I have tried basic troubleshooting (restart, reinstall dependencies, etc.)
0 条评论