一、接口介绍
·检索方式:基于 query 文本进行智能检索,结合语义理解与关键词匹配,返回带相关性评分(score)的记忆列表,score 越高表示与查询文本的相关性越强。
·过滤条件:支持按记忆类型(type)过滤以缩小检索范围。time_start / time_end 参数当前已可传入但检索时暂未生效,传时间范围不会影响检索结果。
·返回数量:单次最多返回 100 条结果,默认返回 5 条。
二、Method 与 URL
POST https://memory.tdai.tencentyun.com/v3/atomic/search
三、使用示例
curl -i -k -X POST \\ -H 'Content-Type: application/json' \\ -H 'Authorization: Bearer *********************************' \\ -H "x-tdai-service-id: tdai-mem-xxxxxxxx" \\ https://memory.tdai.tencentyun.com/v3/atomic/search \\ -d '{ "team_id":"team-abc123", "user_id":"usr-456", "agent_id":"agt-xyz789", "query":"会议时间偏好", "limit":5 }'
四、请求参数
| 参数 | 是否必选 | 参数含义 | 配置方法及要求 |
| team_id | 否 | 团队 ID。 | 数据类型:String。 |
| user_id | 否 | 用户 ID。 | 数据类型:String。 |
| agent_id | 否 | Agent ID(全局唯一)。 | 数据类型:String。 |
| task_id | 否 | Task ID。 | 数据类型:String。 |
| query | 是 | 检索关键词或短语。 | 数据类型:String。长度限制:[1, 2048]。 |
| type | 否 | 按记忆类型过滤。 | 数据类型:String。可选值:episodic:情节记忆persona:人设记忆instruction:指令记忆不传则检索全部类型。 |
| time_start | 否 | 检索时间范围起点(暂未生效)。 | 数据类型:String。格式:ISO 8601(如 2026-07-01T00:00:00Z)。当前可传入但检索时暂未使用,传时间范围不会影响检索结果。 |
| time_end | 否 | 检索时间范围终点(暂未生效)。 | 数据类型:String。格式:ISO 8601(如 2026-07-22T23:59:59Z)。当前可传入但检索时暂未使用,传时间范围不会影响检索结果。 |
| limit | 否 | 返回的最大命中条数。 | 数据类型:Integer。取值范围:[1, 100]。默认值:5。 |
五、响应示例
{ "code":0, "message":"ok", "request_id":"req-7fd3b2dd", "data":{ "items":[ { "id":"atm-aabb", "version":1, "type":"episodic", "content":"用户每周三上午 10:00 参加产品评审会", "created_at":"2026-07-22T10:00:00Z", "updated_at":"2026-07-22T10:00:00Z", "score":0.93 }, { "id":"atm-eeff", "version":1, "type":"persona", "content":"用户习惯在上午处理需要深度思考的工作", "created_at":"2026-07-20T09:00:00Z", "updated_at":"2026-07-20T09:00:00Z", "score":0.68 } ] }}
六、响应参数说明
| 参数名(一级) | 参数名(二级) | 参数含义 |
| data | items | 检索命中原子记忆列表,按 score 降序排列。 |
| | items[].id | 原子记忆唯一 ID。 |
| | items[].version | 当前版本号,数值类型,从 1 开始递增。 |
| | items[].type | 记忆类型:episodic 情节记忆、persona 人设记忆、instruction 指令记忆。 |
| | items[].content | 记忆文本内容。 |
| | items[].background | 更新/创建背景说明(如有)。 |
| | items[].created_at | 创建时间,ISO 8601 格式。 |
| | items[].updated_at | 最后更新时间,ISO 8601 格式。 |
| | items[].score | 语义相关度评分,取值范围 [0, 1],值越高越相关。 |