長期記憶抽取
更新時間:
kv抽取
HTTP接口
shell
curl --location 'https://nlp.aliyuncs.com/v2/api/extract/kv' \
--header 'Expect;' \
--header 'accept: */*' \
--header 'Content-Type: application/json' \
--header 'x-fag-servicename: aca-extract-memory-kv' \
--header 'x-fag-appcode: aca' \
--header 'Authorization: Bearer your-api-key' \
--data '{
"messages": [
{
"content": "我喜歡打武術(shù)",
"role": "user"
},
{
"content": "那很好,武術(shù)不僅是一種技藝,更是一種修身養(yǎng)性的方式。",
"role": "assistant"
}
],
"kvMemoryConfigs": [
{
"memoryText": "職業(yè)"
},
{
"memoryText": "喜歡"
},
{
"memoryText": "名字"
}
]
}'
python
import json
import requests
api_key = "your-api-key"
service_name = "aca-chat-reminder"
url = "https://nlp.aliyuncs.com/v2/api/extract/kv"
headers = {
"Content-Type": "application/json",
"x-fag-servicename": "aca-extract-memory-kv",
"x-fag-appcode": "aca",
"Authorization": f"Bearer {api_key}"
}
payload = {
"messages": [
{
"content": "我喜歡打武術(shù)",
"role": "user"
},
{
"content": "那很好,武術(shù)不僅是一種技藝,更是一種修身養(yǎng)性的方式。",
"role": "assistant"
}
],
"kvMemoryConfigs": [
{
"memoryText": "職業(yè)"
},
{
"memoryText": "喜歡"
},
{
"memoryText": "名字"
}
]
}
response = requests.post(url, headers=headers, json=payload)
print(response.status_code)
print(json.loads(response.text))
summary抽取
HTTP接口
shell
curl --location 'https://nlp.aliyuncs.com/v2/api/extract/summary' \
--header 'Expect;' \
--header 'accept: */*' \
--header 'Content-Type: application/json' \
--header 'x-fag-servicename: aca-extract-memory-summary' \
--header 'x-fag-appcode: aca' \
--header 'Authorization: Bearer your-api-key' \
--data '{
"messages": [
{
"role": "user",
"content": "你好"
},
{
"role": "assistant",
"content": "你好呀,今天天氣真好"
},
{
"role": "user",
"content": "我們一起去打籃球把"
},
{
"role": "assistant",
"content": "好的呀,那我們一起去打球吧,打完籃球我們?nèi)コ曰疱?
}
]
}'
python
import json
import requests
api_key = "your-api-key"
service_name = "aca-chat-reminder"
url = "https://nlp.aliyuncs.com/v2/api/extract/summary"
headers = {
"Content-Type": "application/json",
"x-fag-servicename": "aca-extract-memory-summary",
"x-fag-appcode": "aca",
"Authorization": f"Bearer {api_key}"
}
payload = {
"messages": [
{
"role": "user",
"content": "你好"
},
{
"role": "assistant",
"content": "你好呀,今天天氣真好"
},
{
"role": "user",
"content": "我們一起去打籃球把"
},
{
"role": "assistant",
"content": "好的呀,那我們一起去打球吧,打完籃球我們?nèi)コ曰疱?
}
]
}
response = requests.post(url, headers=headers, json=payload)
print(response.status_code)
print(json.loads(response.text))
文檔內(nèi)容是否對您有幫助?