Chat with PDF 与 PDF 聊天
开发环境
开发环境
POST
/v1/chats/message
参考来源
referenceSources: true
字段:{
"referenceSources": true,
"sourceId": "src_xxxxxx",
"messages": [
{
"role": "user",
"content": "how much is the world?"
}
]
}
referenceSources: true
字段:响应将包含 [P] 形式的内联引用,例如[P2]、[P234] 和附加字段参考:{
"content": "The world is 10 dollars [P2] and can be bought at the supermarket [P5].",
"references": [
{ "pageNumber": 2 },
{ "pageNumber": 5 }
]
}
流响应
stream: true
字段:{
"stream": true,
"sourceId": "src_xxxxxx",
"messages": [
{
"role": "user",
"content": "how much is the world?"
}
]
}
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'http://dev-cn.your-api-server.com/v1/chats/message' \
--header 'x-api-key: sec_xxxxxx' \
--header 'Content-Type: application/json' \
--data-raw '{"sourceId": "src_xxxxxx", "messages": [{"role": "user", "content": "Who wrote the consitution?"}]}'
响应示例响应示例
{
"content": "The world is 10 dollars."
}
请求参数
Header 参数
x-api-key
string
必需
示例值:
sec_xxxxxx
Content-Type
string
必需
示例值:
application/json
Body 参数application/json
返回响应
修改于 2023-12-13 06:29:12