72 lines
3.0 KiB
Plaintext
72 lines
3.0 KiB
Plaintext
创建用户
|
|
curl -sS -X POST "http://localhost:1934/memory-system/users" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"user_id":"userC"}'
|
|
|
|
{"status":"success","account":{"status":"ok","result":{"account_id":"userC_account","admin_user_id":"userC","isolate_user_scope_by_agent":false,"isolate_agent_scope_by_user":false,"user_key":"dXNlckNfYWNjb3VudA.dXNlckM.ZDFlMGI2OWI0NzZkZmZiMGExOWFlNGQ2N2JjYzMxNTg4NzVjZmNhN2Q4MTYwYmU1NGE4YWZjZTdjYzliMDI3NQ"},"error":null,"telemetry":null,"profile":null},"backends":{"openviking":{"status":"success","result":{"status":"ok","result":{"account_id":"userC_account","admin_user_id":"userC","isolate_user_scope_by_agent":false,"isolate_agent_scope_by_user":false,"user_key":"dXNlckNfYWNjb3VudA.dXNlckM.ZDFlMGI2OWI0NzZkZmZiMGExOWFlNGQ2N2JjYzMxNTg4NzVjZmNhN2Q4MTYwYmU1NGE4YWZjZTdjYzliMDI3NQ"},"error":null,"telemetry":null,"profile":null},"error":null}}}
|
|
|
|
插入信息
|
|
curl -sS -X POST "http://localhost:1934/memory-system/messages" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"user_id": "userC",
|
|
"user_key": "dXNlckNfYWNjb3VudA.dXNlckM.ZDFlMGI2OWI0NzZkZmZiMGExOWFlNGQ2N2JjYzMxNTg4NzVjZmNhN2Q4MTYwYmU1NGE4YWZjZTdjYzliMDI3NQ",
|
|
"session_id": "sessionC1",
|
|
"user_message": "我喜欢拿铁。",
|
|
"assistant_message": "好的,我记住了。"
|
|
}'
|
|
|
|
存储记忆
|
|
curl -sS -X POST "http://localhost:1934/memory-system/sessions/sessionC1/commit" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"user_id": "userC",
|
|
"user_key": "dXNlckNfYWNjb3VudA.dXNlckM.ZDFlMGI2OWI0NzZkZmZiMGExOWFlNGQ2N2JjYzMxNTg4NzVjZmNhN2Q4MTYwYmU1NGE4YWZjZTdjYzliMDI3NQ"
|
|
}'
|
|
|
|
全局搜索
|
|
curl -sS -X POST "http://localhost:1934/memory-system/search" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"user_id": "userC",
|
|
"user_key": "dXNlckNfYWNjb3VudA.dXNlckM.ZDFlMGI2OWI0NzZkZmZiMGExOWFlNGQ2N2JjYzMxNTg4NzVjZmNhN2Q4MTYwYmU1NGE4YWZjZTdjYzliMDI3NQ",
|
|
"session_id": "sessionC1",
|
|
"query": "大语言模型应用是什么",
|
|
"limit": 10,
|
|
"level": 2,
|
|
"score_threshold": 0.8
|
|
}' | jq .
|
|
|
|
curl -s -X POST http://localhost:1933/api/v1/search/search \
|
|
-H "Content-Type: application/json" \
|
|
-H "Authorization: Bearer 3f7a4b4faae1e2d49583a0e45d9ba5b51f3d0f545d97c9b6c4f19171f717e8af" \
|
|
-d '{
|
|
"query": "大语言模型应用是什么",
|
|
"level": 2
|
|
}' | jq .
|
|
|
|
会话查询
|
|
curl -sS -X POST "http://localhost:1934/memory-system/sessions/sessionB1/context" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"user_id": "userB",
|
|
"user_key": "1e5f24acba77017e7506e6df9d668aebc0ddc91c4ed9af77c6d8da5e9d4ed6c7",
|
|
"query": "我喜欢喝什么?",
|
|
"limit": 10
|
|
}' | jq .
|
|
|
|
用户画像查询
|
|
curl -sS -X POST "http://localhost:1934/memory-system/users/userB/profile" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"user_key": "1e5f24acba77017e7506e6df9d668aebc0ddc91c4ed9af77c6d8da5e9d4ed6c7",
|
|
"query": "我想喝东西",
|
|
"limit": 10,
|
|
"level": 2
|
|
}' | jq .
|
|
|
|
上传文件
|
|
|
|
|
|
|