当您的后端显式控制记忆写入和读取时,请使用 REST API。这两项操作均使用项目的sk- 客户端密钥进行身份验证。
#捕获
curl -X POST https://api.agihalo.com/api/v1/memory/capture \
-H "Authorization: Bearer $HALO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"projectKey": "customer-product",
"endUserKey": "user_123",
"sessionData": {
"messages": [
{
"role": "user",
"content": "Keep my weekly reports short and send them in the morning."
}
]
},
"response": {
"role": "assistant",
"content": "I will keep them concise and morning-ready."
}
}'Capture 存储原始交换、写入使用情况,并对记忆工作线程进行主题分类和汇总工作排队。
#直接检索
curl -X POST https://api.agihalo.com/api/v1/memory/retrieve \
-H "Authorization: Bearer $HALO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"projectKey": "customer-product",
"endUserKey": "user_123",
"topics": ["report_preferences"],
"limit": 5,
"includeRaw": true,
"includeDisabledTopics": false
}'| 字段 | 目的 |
|---|---|
topics | 限制显式主题键 |
limit | 绑定返回的原始记录 |
includeRaw | 包括链接的源交换 |
includeDisabledTopics | 包括无法正常检索的主题 |
#端点摘要
POST
/api/v1/memory/capturePOST
/api/v1/memory/retrievePOST
/api/v1/memory/functions/halo_retrieve_end_user_memoryPOST
/api/v1/memory/delete