表格文件对话测试
更新时间:2025-01-17
API访问域名
请求方式 | POST | 说明 |
---|---|---|
online base url | https://keyue.cloud.baidu.com/online | AI客服发布后的请求地址 |
offline base url | https://keyue.cloud.baidu.com | AI客服测试调试地址 |
后缀接口 | /core/v5/stream/query | |
Authentication | token为API Key |
说明
无
请求参数
Header参数
名称 | 类型 | 必选 | 中文名 | 说明 |
---|---|---|---|---|
token | string | 是 | API KEY | 集成-API-API Key处获取。 详细获取方式参考:准备工作 |
Body参数
名称 | 类型 | 必填 | 中文名 | 说明 |
---|---|---|---|---|
queryText | string | 是 | 用户问题 | 请求的问题,比如示例中的:你好 |
sessionId | string | 否 | 会话id | 用于标识一个访问者的会话和保持上下文信息,在首轮对话中可以为空。 |
engines | array | 否 | 使用的对话引擎 | 当执行表格问答测试是为"table_qa" |
knowledgeLabelList | List |
响应参数
名称 | 类型 | 必选 | 中文名 | 说明 |
---|---|---|---|---|
sessionId | string | 是 | 会话ID | 用于标识本轮会话的唯一ID |
queryId | string | 是 | 对话ID | 用于标识本次对话的唯一ID |
replyStatus | integer | 是 | 回复状态 | 回复状态,默认成功SUCCESS(200, "成功");FAIL(4008001, "失败"); |
answer | array | 是 | 回答列表 | 包含各个回答块的数组,详见answer子数据 |
variables | object | 是 | 变量信息 | 包含与对话相关的变量,详见variables子数据 |
endTime | null | 是 | 结束时间 | |
recommendList | array | 是 | 推荐列表 | ? |
rewriteQuery | string | 是 | 重写查询 | 经过处理后的查询内容 |
intent | array | 是 | 意图信息 | 包含多个意图相关信息,详见intent子数据 |
replyInfo | null | 是 | 回复信息 | |
needIgnoreDialogHistory | boolean | 是 | 是否忽略对话历史 | false 表示不忽略对话历史 |
answer子数据
名称 | 类型 | 必选 | 中文名 | 说明 |
---|---|---|---|---|
chunkId | integer | 是 | 流式chunkId | 流式会话将AI的回答分块(chunk)返回,一次返回一个chunk,该参数标识一次对话中的唯一chunk |
status | string | 是 | 流式返回数据状态 | RUNNING("running")表示还有未传完的chunk;DONE("done")表示当前chunk为该轮对话中的最后一个chunk; |
topicId | string | 否 | 主题ID | 对应的主题ID |
blockId | string | 否 | 区块ID | 对应的区块ID |
nodeId | string | 否 | 节点ID | 对应的节点ID |
reply | object | 否 | 回复 | 包含回复相关详细信息的对象,详见reply子数据 |
instruction | null | 是 | 指令 | null |
statisticsInfo | null | 是 | 统计信息 | null |
debugReplyType | string | 是 | 调试回复类型 | 表明调试回复类型为 “table_qa” |
debugNodeName | null | 是 | 调试节点名称 | null |
debugInputParam | null | 是 | 调试输入参数 | null |
debugCost | null | 是 | 调试成本 | null |
debugResult | null | 是 | 调试结果 | null |
reply子数据
名称 | 类型 | 必选 | 中文名 | 说明 |
---|---|---|---|---|
type | integer | 是 | 回复类型 | 1 (文本)3(富文本)8(列表) |
text | string | 是 | 文本 | 文本/富文本答案 |
textList | array | 否 | 文本列表 | 回复的文本列表 |
clarifyGuide | string | 否 | 澄清指南 | 提供澄清相关的指南和信息 |
replySource | string | 是 | 回复来源 | "TABLE_QA"表面回复来源表格 |
showDocumentSource | boolean | 否 | 显示文档源 | 是否显示文档来源 |
documents | null | |||
tableQAInfo | object | 是 | 表格问答信息 | 包含与表格问答相关的详细信息,详见tableQAInfo子数据 |
docDebug | object | 否 | 文档调试 | 提供文档调试相关信息,replySource是DOC_QA 该字段有值 |
faqSearch | array | 否 | FAQ搜索 | faq 检索信息,replySource是FAQ 该字段有值 |
slotCollectInfo | object | 否 | 槽收集信息 | 收集槽信息 |
buttons | null | 是 | 按钮信息 | null |
intentName | null | 是 | 意图名称 | null |
tableQAInfo子数据
名称 | 类型 | 必选 | 中文名 | 说明 |
---|---|---|---|---|
sourceCode | string | 是 | 源代码 | 执行的查询代码,用于获取表格信息 |
tableSelectResult | array | 是 | 表格选择结果 | 包含所选表格的相关信息,详见tableSelectResult子数据 |
tableSelectResult子数据
名称 | 类型 | 必选 | 中文名 | 说明 |
---|---|---|---|---|
file_name | string | 是 | 文件名 | 所选表格所在的文件名 |
table_name | string | 是 | 表名 | 所选的具体sheet名 |
datasource_id | string | 是 | 数据源 ID | null |
bos_url | string | 是 | BOS URL | 用于下载相关文件的链接 |
variables子数据
名称 | 类型 | 必选 | 中文名 | 说明 |
---|---|---|---|---|
last_intent | string | 是 | 上一个意图 | 记录上一次的意图 |
LLM_rewrite_query | string | 是 | 大语言模型重写的查询 | 经过大语言模型处理后的查询内容 |
last_user_response | string | 是 | 上一个用户回复 | 用户上一次的回复内容 |
intent子数据
名称 | 类型 | 必选 | 中文名 | 说明 |
---|---|---|---|---|
_effect | integer | 是 | 意图效果 | 0 |
id | string | 是 | 意图 ID | 每个意图的唯一标识符 |
name | string | 是 | 名称 | 意图的名称 |
description | string | 否 | 描述 | 意图的描述 |
agentId | string | 否 | 代理ID | 代理的ID |
created | string | 否 | 创建时间 | 意图创建时间 |
updated | string | 否 | 更新时间 | 意图最后更新时间 |
confidence | float | 是 | 置信度 | 意图识别的置信度 |
source | string | 是 | 来源 | 意图识别的来源 |
threshold | float | 是 | 阈值 | 意图识别的阈值 |
system | boolean | 是 | 系统意图 | 是否为系统预定义的意图 |
needClarify | boolean | 是 | 需要澄清 | 是否需要澄清此意图 |
alias | string | 否 | 别名 | 意图的别名 |
nameZh | string | 是 | 中文名称 | 意图的中文名称 |
examples | array | 否 | 示例 | 意图的示例 |
hasActiveCopy | boolean | 是 | 活跃副本 | 意图是否有活跃的副本 |
templateStr | string | 否 | 模板字符串 | 意图的模板字符串 |
createdUserName | string | 否 | 创建者用户名 | 创建此意图的用户的用户名 |
createdUserId | string | 否 | 创建者用户ID | 创建此意图的用户的用户ID |
lastEditUserName | string | 否 | 最后编辑用户名 | 最后编辑此意图的用户的用户名 |
lastEditUserId | string | 否 | 最后编辑用户ID | 最后编辑此意图的用户的用户ID |
version | integer | 是 | 版本 | 意图的版本 |
industryIntent | boolean | 是 | 行业意图 | 是否为特定行业的意图 |
knnExampleStr | string | 是 | KNN示例字符串 | 用于KNN匹配的示例字符串 |
extra | object | 否 | 额外信息 | 包含额外信息的对象 |
recSource | string | 否 | 推荐来源 | 意图推荐的来源 |
noResponse | boolean | 是 | 无响应 | 是否未响应 |
请求示例
Bash
1curl --location --request POST 'https://keyue.cloud.baidu.com/core/v5/stream/query'
2--header 'token: xxxx'
3--header 'Content-Type: application/json'
4--data '{
5 "engines": [
6 "table_qa"
7 ],
8 "knowledgeLabelList": [
9 "92bd88b5-c3fd-4640-8fd3-29fb2415487b",
10 "129c3558-92bf-480e-a4bd-b2f462c9f6e8",
11 "46d9771e-251c-4654-b187-0bd8b0a182c4"
12 ],
13 "queryText": "查询表格",
14 "sessionId": ""
15}'
响应示例
成功示例
1{
2 "sessionId": "0d666d27-ced6-4c85-9cc4-2b4227c0ca13",
3 "queryId": "26492709-7538-44aa-a9c4-c119a7ab42d5",
4 "replyStatus": 200,
5 "answer": [
6 {
7 "chunkId": 0,
8 "status": "done",
9 "topicId": "",
10 "blockId": "",
11 "nodeId": "",
12 "name": null,
13 "taskFlowSolved": null,
14 "reply": {
15 "type": 1,
16 "text": "抱歉,您的问题可能需要更具体的描述,才能帮助您进行查询。请问您是想查询订单表、客户表还是产品表的信息呢?或者您是想查询某个特定订单、客户或产品的信息呢?请提供更多的信息以便我们能够为您提供帮助。",
17 "textList": null,
18 "clarifyGuide": null,
19 "replySource": "TABLE_QA",
20 "showDocumentSource": true,
21 "documents": null,
22 "tableQAInfo": {
23 "sourceCode": "# 查询所有表格的基本信息,包括前5行数据和列名\nprint(\"订单表信息:\")\nprint(df1.info())\nprint(df1.head())\n\nprint(\"\\n客户表信息:\")\nprint(df2.info())\nprint(df2.head())\n\nprint(\"\\n产品表信息:\")\nprint(df3.info())\nprint(df3.head())",
24 "tableSelectResult": [
25 {
26 "file_name": "wwide.xlsx",
27 "table_name": "订单",
28 "datasource_id": "",
29 "bos_url": "https://keyue-test.cloud.baidu.com/api/v2/file/download?key=Ym9zXzFlYzZiOGU4LTBmYzgtNDQ3MC05MTg5LTJmYTRjNzg3N2U1Nw==",
30 "file_id": "4169e31a-3847-42cc-aabc-93a1e05e4929"
31 },
32 {
33 "file_name": "wwide.xlsx",
34 "table_name": "客户表",
35 "datasource_id": "",
36 "bos_url": "https://keyue-test.cloud.baidu.com/api/v2/file/download?key=Ym9zXzFlYzZiOGU4LTBmYzgtNDQ3MC05MTg5LTJmYTRjNzg3N2U1Nw==",
37 "file_id": "4169e31a-3847-42cc-aabc-93a1e05e4929"
38 },
39 {
40 "file_name": "wwide.xlsx",
41 "table_name": "产品表",
42 "datasource_id": "",
43 "bos_url": "https://keyue-test.cloud.baidu.com/api/v2/file/download?key=Ym9zXzFlYzZiOGU4LTBmYzgtNDQ3MC05MTg5LTJmYTRjNzg3N2U1Nw==",
44 "file_id": "4169e31a-3847-42cc-aabc-93a1e05e4929"
45 }
46 ]
47 },
48 "docDebug": null,
49 "faqSearch": null,
50 "slotCollectInfo": null,
51 "plugin": null,
52 "url": null,
53 "buttons": null,
54 "intentName": null
55 },
56 "instruction": null,
57 "statisticsInfo": null,
58 "debugReplyType": "table_qa",
59 "debugNodeName": null,
60 "debugInputParam": null,
61 "debugCost": null,
62 "debugResult": null
63 }
64 ],
65 "variables": {
66 "last_intent": "",
67 "LLM_rewrite_query": "查询表格",
68 "last_user_response": "查询表格"
69 },
70 "endTime": null,
71 "recommendList": [
72
73 ],
74 "rewriteQuery": "查询表格",
75 "intent": [
76 {
77 "_effect": 0,
78 "id": "sys_intent_18",
79 "name": "sys_table_qa",
80 "description": null,
81 "agentId": null,
82 "created": null,
83 "updated": null,
84 "confidence": 0,
85 "source": null,
86 "threshold": 0,
87 "system": false,
88 "needClarify": false,
89 "alias": null,
90 "nameZh": "表格问数意图",
91 "examples": null,
92 "hasActiveCopy": false,
93 "templateStr": null,
94 "createdUserName": null,
95 "createdUserId": null,
96 "lastEditUserName": null,
97 "lastEditUserId": null,
98 "version": null,
99 "industryIntent": false,
100 "knnExampleStr": null,
101 "extra": null,
102 "recSource": "largeModel",
103 "noResponse": false
104 }
105 ],
106 "replyInfo": null,
107 "needIgnoreDialogHistory": false,
108 "agentType": 1,
109 "qps": 1,
110 "totalTokens": 0,
111 "statisticsInfoMap": {
112 "unMatch": null
113 },
114 "firstChunkTime": 0,
115 "instructionList": null
116}