ai-robot-core/ai-service/tools/memory_recall.md

68 lines
1.9 KiB
Markdown
Raw Normal View History

---
name: memory_recall
description: 记忆召回工具读取用户可用记忆包profile/facts/preferences/summary/slots)
triggers:
- 需要补全用户画像信息
- 需要获取用户历史事实
- 需要了解用户偏好设置
- 需要获取用户槽位信息
- 避免重复追问用户已知信息
anti_triggers:
- 当前轮次已有完整上下文且无需个性化记忆支撑
- 用户首次对话,无历史记忆
- 当前任务不依赖用户历史信息
tools:
- memory_recall
---
## 使用指南
### 何时使用
当需要补全用户画像、历史事实、偏好、槽位,避免重复追问时使用。
### 何时不使用
当当前轮次已经有完整上下文且无需个性化记忆支撑时可不调用。
### 召回范围
| 范围 | 说明 |
|-----|------|
| profile | 用户画像信息 |
| facts | 用户历史事实 |
| preferences | 用户偏好设置 |
| summary | 会话摘要 |
| slots | 用户槽位信息 |
### 参数说明
| 参数 | 类型 | 必填 | 说明 |
|-----|------|-----|------|
| tenant_id | string | 否 | 租户 ID系统自动注入) |
| user_id | string | 否 | 用户 ID |
| session_id | string | 否 | 会话 ID |
| recall_scope | array | 否 | 召回范围,如 ["profile", "facts"] |
| max_recent_messages | integer | 否 | 历史回填窗口大小 |
### 示例调用
```json
{
"recall_scope": ["profile", "facts", "preferences", "summary", "slots"],
}
```
### 结果解释
关注以下字段:
- `profile`: 用户画像信息
- `facts`: 用户历史事实
- `preferences`: 用户偏好
- `slots`: 用户槽位
- `missing_slots`: 缺失的槽位
`fallback_reason_code` 存在,需降级处理。
### 注意事项
1. tenant_id 由系统自动注入,模型不要填写
2. recall_scope 可根据需要选择范围,不必全部召回
3. 召回的记忆信息应用于个性化回复,避免重复追问
4. 如果用户信息已完整,可以不调用此工具