方法介绍
delete_atomic 用于按笔记 id 批量删除 L1 原子记忆笔记。功能说明如下:删除方式:按笔记 id 删除,单次最少 1 条、最多 100 条。
不可逆:删除为不可逆操作,被删除的笔记将从 L1 存储中移除。
说明:
已基于该笔记聚合出的 L2/L3 记忆不受影响。
导入
from tencentdb_agent_memory.v3 import MemoryClient
使用示例
from tencentdb_agent_memory.v3 import MemoryClientwith MemoryClient(endpoint="https://memory.tdai.tencentyun.com",api_key="sk-xxxxxxxxxxxxxxxx",service_id="tdai-mem-xxxxxxxx",team_id="team-abc123",agent_id="agt-xyz789",user_id="usr-456",) as client:result = client.delete_atomic(ids=["note-xxxx", "note-yyyy", "note-zzzz"],)print(f"已删除 {result['deleted_count']} 条笔记")
请求参数
参数名 | 类型 | 必填 | 描述说明 |
ids | List[str] | 是 | 待删除的笔记 id 列表,单次 1–100 条 |
响应示例
{"deleted_count": 3}
Running Environment
Operating System: Ubuntu 24.04.3 LTS / x86_64
Runtime Version: Python 3.11.1
响应参数说明
参数名 | 类型 | 参数含义 |
deleted_count | int | 成功删除的笔记数量 |
错误码
错误码 | 触发场景 | 处理建议 |
400 | ids 为空或超过 100 条 | 检查 ids 长度 |
401 | API Key 无效或过期 | 检查 api_key 配置 |
422 | 构造参数缺失 | 确保构造时传入必填归属参数 |