接口文档
更新时间:2024-05-20
接口文档
版本:v1.0.0
流式对话接口
Base URL: https://keyue.cloud.baidu.com/online
接口后缀:/core/v5/stream/query
请求方式:POST
Authentication:token为API Key
1、Curl 请求示例
curl --location 'https://keyue.cloud.baidu.com/online/core/v5/stream/query'
--header 'token: xxxx'
--header 'Content-Type: application/json'
--data '{
"queryText": "你好",
"sessionId": "ecb95fcc-0e49-4ab0-b026-c20a8aac1585",
"variables": {
"homeAddress": "chengdu"
}
}'
2、请求参数
Header 参数
名称 | 类型 | 必选 | 中文名 | 说明 |
---|---|---|---|---|
token | string | 是 | none | agent token,可以在页面集成-API-API Key获取 |
Body 参数
名称 | 类型 | 必选 | 中文名 | 说明 |
---|---|---|---|---|
queryText | string | 否 | 用户问题 | 请求的问题,比如示例中的:你好 |
sessionId | string | 否 | 会话id | 首轮可以为空(如果首轮传了,后续需要使用首轮传的。),首轮会返回sessionId,后续对话需要使用返回的sessionId。 |
variables | object | 否 | 变量 | Map格式,key 是变量名称,value是变量值。对话中使用的变量,如果传了会覆盖当前中对话中已有的变量值 |
topicId | string | 否 | 主题id | 对话测试时使用,执行指定的topic,和nodeId配合使用 |
engines | array | 否 | 使用的对话引擎 | String类型,FAQ("faq", "知识库-FAQ"),DOC_QA("docQa", "知识库-文档问答"),TASK_FLOW("taskflow", "流程画布"),TASK_BASED("task_based", "意图识别"),为null 或taskflow是支持所有引擎 |
startId | string | 否 | 节点id | 对话测试时使用,执行指定的节点id。和topicId配合使用 |
3、返回响应
数据结构
名称 |
类型 |
必选 |
中文名 |
说明 |
---|---|---|---|---|
sessionId | string | 是 | 会话ID | 用于标识本轮会话的唯一ID |
queryId | string | 是 | 查询ID | 用于标识本次会话的唯一ID |
replyStatus | integer | 是 | 回复状态 | 回复状态,默认成功SUCCESS(200, "成功");FAIL(4008001, "失败"); |
answer | array | 是 | 回答列表 | 包含各个回答块的数组 |
→ chunkId | integer | 是 | 流式chunkId | 流式chunkId |
→ status | string | 是 | 流式返回数据状态 | RUNNING("running");DONE("done"); |
→ topicId | string | 否 | 主题ID | 对应的主题ID |
→ blockId | string | 否 | 区块ID | 对应的区块ID |
→ nodeId | string | 否 | 节点ID | 对应的节点ID |
→ reply | object | 否 | 回复 | 包含回复相关详细信息的对象 |
→ → type | integer | 是 | 回复类型 | 1 (文本)3(富文本)8(列表) |
→ → text | string | 是 | 文本 | 文本/富文本答案 |
→ → textList | array | 否 | 文本列表 | 回复的文本列表 |
→ → clarifyGuide | string | 否 | 澄清指南 | 提供澄清相关的指南和信息 |
→ → replySource | string | 是 | 回复来源 | FAQ("faq", "知识库-FAQ"),DOC_QA("docQa", "知识库-文档"),TEXT_REPLY("text", "文本回复"),INTENT_CLARIFY("intentClarify", "意图澄清"),LARGE_MODEL_REPLY("largeModelReply", "大模型回复"),COLLECT_SLOT_ENTITY("collectSlotEntity", "收集槽位实体"),CHITCHAT("chitchat", "闲聊"),UNMATCHED("unmatch", "未匹配固定话术"),SENSITIVE("sensitive", "敏感拒答话术"),SYSTEM("system", "系统异常"),INSTRUCTION("instruction", "指令"); |
→ → showDocumentSource | boolean | 否 | 显示文档源 | 是否显示文档来源 |
→ → documents | array | 是 | 文档 | 知识问答信息,replySource是DOC_QA 该字段有值 |
→ → → document_id | string | 是 | 文档ID | 文档的唯一标识符 |
→ → → document_name | string | 是 | 文档名 | 文档的名称 |
→ → → knowledge_type | string | 是 | 文档类型 | 文档类型:doc 普通文档, web 网页知识 |
→ → → web_url | string | 是 | 文档链接 | 文档链接,当knowledgeType 是 web 时有值 |
→ → → data | array | 是 | 数据 | 文档的数据内容 |
→ → → → segment_id | string | 是 | 段落ID | 段落的唯一标识符 |
→ → → → segment_content | string | 是 | 段落内容 | 段落的文本内容 |
→ → → → score | string | 是 | 得分 | 段落相关性得分 |
→ → → → segment_coord | string | 是 | 段落坐标 | 段落在文档中的位置坐标 |
→ → → → data | array | 是 | 数据 | 段落中的句子数据 |
→ → → → → sentence_id | string | 是 | 句子ID | 句子的唯一标识符 |
→ → → → → sentence_content | string | 是 | 句子内容 | 句子的文本内容 |
→ → → → → score | string | 是 | 得分 | 句子相关性得分 |
→ → docDebug | object | 否 | 文档调试 | 提供文档调试相关信息,replySource是DOC_QA 该字段有值 |
→ → faqSearch | array | 否 | FAQ搜索 | faq 检索信息,replySource是FAQ 该字段有值 |
→ → slotCollectInfo | object | 否 | 槽收集信息 | 收集槽信息 |
→ → → waitCollectResultList | array | 是 | 待收集结果列表 | 列出待收集的结果 |
→ → → → name | string | 是 | 名称 | 待收集的槽名称 |
→ → → → result | string | 是 | 结果 | 已收集的结果 |
→ → → → option | array | 否 | 可选值 | 可选的答案 |
→ → → → optionSize | integer | 否 | 选项数量 | 选项数量 |
→ → → → clarity | string | 否 | 清晰度 | 澄清话术 |
→ → → → inputExample | string | 是 | 输入示例 | 输入的示例 |
→ → → → outputExample | string | 是 | 输出示例 | 输出的示例 |
→ → → hasCollectResultList | array | 是 | 已收集结果列表 | 列出已收集的结果 |
instruction | object | 否 | 指令 | 发出指令后有值,指令详细信息 Map<String, Map<String, String>>, 外层key为指令标识,value为指令参数map |
variables | object | 是 | 变量 | Map<String, Object>存储会话期间的各种变量信息 |
endTime | string | 否 | 结束时间 | 会话结束时间 |
recommendList | array | 是 | 推荐列表 | 提供可能的操作或信息的推荐列表 |
rewriteQuery | string | 是 | 重写查询 | 用户输入的重写版本 |
intent | array | 是 | 意图 | 列出此次会话涉及的意图 |
→ _effect | integer | 是 | 影响 | 表示此意图的效果 |
→ 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 | 是 | 无响应 | 是否未响应 |
4、返回示例
{
"sessionId": "02329c01-7720-45e9-b19c-6dfacec87b81",
"queryId": "39ad613a-a089-4019-baa4-8f48558b5f63",
"replyStatus": 200,
"answer": [
{
"chunkId": 0,
"status": "done",
"topicId": "",
"blockId": "",
"nodeId": "",
"reply": null,
"instruction": null
}
],
"variables": {
"last_response": "",
"last_user_response": "我要租车",
"LLM_rewrite_query": "我要租车",
"triggered_intent": [
"我要租车",
"我要租车"
],
"last_intent": "我要租车"
},
"endTime": null,
"recommendList": [
"今天天气怎么样"
],
"rewriteQuery": "我要租车",
"intent": [
{
"_effect": 0,
"id": "946f7bf7-0d29-11ef-81bf-fa20202f5a70",
"name": "h4f4e8f6",
"description": "",
"agentId": null,
"created": null,
"updated": null,
"confidence": 1.0,
"source": "knnExactly",
"threshold": 0.0,
"system": false,
"needClarify": false,
"alias": null,
"nameZh": "我要租车",
"examples": null,
"hasActiveCopy": false,
"templateStr": null,
"createdUserName": null,
"createdUserId": null,
"lastEditUserName": null,
"lastEditUserId": null,
"version": 0,
"industryIntent": false,
"knnExampleStr": "我要租车",
"extra": null,
"recSource": null,
"noResponse": false
}
]
}
{
"sessionId": "948c2eef-02e4-46ff-b9d1-e38833b7764a",
"queryId": "f794f6fe-2483-46a6-86b8-711fd9627ff7",
"replyStatus": 200,
"answer": [{
"chunkId": 2,
"status": "done",
"topicId": "a52cce91-f235-4c6e-96b0-fdb026c0c09c",
"blockId": "xRGRfnMdWCTIxRoUtWAzqK37SuUxnur_ThW_",
"nodeId": "v8tdXcXokpltzHq5NrhXnNEEfjM0s6_wgQxy",
"reply": {
"type": 1,
"text": "这是一个文本节点",
"textList": null,
"clarifyGuide": null,
"replySource": "TEXT_REPLY",
"showDocumentSource": null,
"documents": null,
"docDebug": null,
"faqSearch": null,
"slotCollectInfo": null,
"instruction": null
},
"instruction": null
}],
"variables": {
"date": "2024-05-08",
"last_intent": "",
"week": "3",
"last_task_prompt": "这是一个文本节点",
"time": "19:28:50",
"last_response": "这是一个文本节点",
"last_user_response": ""
},
"endTime": null,
"recommendList": [],
"rewriteQuery": null,
"intent": null
}
{
"sessionId": "0697c039-a3d2-4dfa-9dd6-e0f3480efecd",
"queryId": "41ee2b18-fa37-4900-982f-0ac7bd49289a",
"replyStatus": 200,
"answer": [{
"chunkId": 2,
"status": "done",
"topicId": "a52cce91-f235-4c6e-96b0-fdb026c0c09c",
"blockId": "l8-41S-gL7ri-zryMlFK_QX4HorFnQhFdOuC",
"nodeId": "TIBM8ImijKE3SXIiFX60rRP5Q37tS1TSQvr0",
"reply": {
"type": 1,
"text": "",
"textList": null,
"clarifyGuide": null,
"replySource": "LARGE_MODEL_REPLY",
"showDocumentSource": null,
"documents": null,
"docDebug": null,
"faqSearch": null,
"slotCollectInfo": null,
"instruction": null
},
"instruction": null
}],
"variables": {
"date": "2024-05-08",
"last_intent": "",
"week": "3",
"time": "19:31:28",
"last_response": "当然可以,以下是一首简短的诗歌:\n\n春风轻拂花,\n细雨滋养生。\n心中怀希望,\n未来自光明。",
"last_user_response": ""
},
"endTime": null,
"recommendList": [],
"rewriteQuery": null,
"intent": null
}
{
"sessionId": "168a6818-bb89-4a2c-a9c7-f4f55f304f2f",
"queryId": "67f8b037-99a4-4e33-84cb-d4c747e8c725",
"replyStatus": 200,
"answer": [
{
"chunkId": 0,
"status": "done",
"topicId": "a52cce91-f235-4c6e-96b0-fdb026c0c09c",
"blockId": "DoGqiBQ-iEEPhMv-GgOqiVCTnxBA5sBvrbnB",
"nodeId": "_z1WGiWEdEkdiuwefe7KhWqvnRdcqH0J1Xmv",
"reply": {
"type": 1,
"text": "很抱歉,刘星先生,我注意到您提供的身份证号码似乎不符合标准格式。身份证号码通常是一串特定的数字组合。能否请您再次确认并提供正确的身份证号码呢?这对我们的业务办理至关重要,谢谢。",
"textList": null,
"clarifyGuide": null,
"replySource": "COLLECT_SLOT_ENTITY",
"showDocumentSource": null,
"documents": null,
"docDebug": null,
"faqSearch": null,
"slotCollectInfo": {
"waitCollectResultList": [
{
"name": "身份证号",
"result": "",
"option": null,
"optionSize": null,
"clarity": "",
"inputExample": "120101200001012345,12010120000101234x",
"outputExample": "120101200001012000"
}
],
"hasCollectResultList": [
{
"name": "人名",
"result": "刘星",
"option": null,
"optionSize": null,
"clarity": "",
"inputExample": "贝克汉姆,姚明",
"outputExample": "贝克汉姆"
}
]
},
"instruction": null
},
"instruction": null
}
],
"variables": {
"last_intent": null,
"last_task_prompt": "很抱歉,刘星先生,我注意到您提供的身份证号码似乎不符合标准格式。身份证号码通常是一串特定的数字组合。能否请您再次确认并提供正确的身份证号码呢?这对我们的业务办理至关重要,谢谢。",
"last_response": "很抱歉,刘星先生,我注意到您提供的身份证号码似乎不符合标准格式。身份证号码通常是一串特定的数字组合。能否请您再次确认并提供正确的身份证号码呢?这对我们的业务办理至关重要,谢谢。",
"last_entity_prompt": "很抱歉,刘星先生,我注意到您提供的身份证号码似乎不符合标准格式。身份证号码通常是一串特定的数字组合。能否请您再次确认并提供正确的身份证号码呢?这对我们的业务办理至关重要,谢谢。",
"last_user_response": "小明"
},
"endTime": null,
"recommendList": [],
"rewriteQuery": null,
"intent": null
}
{
"sessionId": "1b7f75ad-b9cb-4155-83b6-a4349aa30170",
"queryId": "47913f67-5abd-410f-9e32-e7996081789a",
"replyStatus": 200,
"answer": [
{
"chunkId": 2,
"status": "done",
"topicId": "a52cce91-f235-4c6e-96b0-fdb026c0c09c",
"blockId": "8P7zEt-ykB5WCCCVFg69Shlp_RxtEP4d9mYa",
"nodeId": "lM8hwEhaPSzK-xghkz9GOEK3ME_VlG4gXFgK",
"reply": null,
"instruction": {
"system_toCustomerService": {
"gotoBed": "sleep"
}
}
}
],
"variables": {
"date": "2024-05-08",
"last_intent": "",
"week": "3",
"time": "19:39:37",
"last_response": "",
"last_user_response": ""
},
"endTime": null,
"recommendList": [],
"rewriteQuery": null,
"intent": null
}
{
"sessionId": "ca6b7dbd-e0cd-4c90-89a2-ad1c2c810ec2",
"queryId": "4d7bcbde-b17d-48ff-b9d0-5a0b4cf5ab3c",
"replyStatus": 200,
"answer": [
{
"chunkId": 0,
"status": "done",
"topicId": "",
"blockId": "",
"nodeId": "",
"reply": {
"type": 1,
"text": "",
"textList": null,
"clarifyGuide": null,
"replySource": "CHITCHAT",
"showDocumentSource": null,
"documents": null,
"docDebug": null,
"faqSearch": null,
"slotCollectInfo": null,
"instruction": null
},
"instruction": null
}
],
"variables": {
"last_response": "是啊,今天的天气确实不错,阳光明媚的,让人心情都跟着愉悦起来了。您打算出门走走,享受一下这美好的天气吗?",
"last_user_response": "今天天气真好啊",
"LLM_rewrite_query": "今天天气真好啊",
"last_intent": ""
},
"endTime": null,
"recommendList": [
"今天天气怎么样"
],
"rewriteQuery": "今天天气真好啊",
"intent": null
}
阻塞式对话接口
Base URL: https://keyue.cloud.baidu.com/online
接口后缀: /core/v5/block/query
请求方式:POST
Authentication:token为API Key
1、Curl 请求示例
curl --location 'https://keyue.cloud.baidu.com/online/core/v5/block/query'
--header 'token: xxxx'
--header 'Content-Type: application/json'
--data '{
"queryText": "你好",
"sessionId": "ecb95fcc-0e49-4ab0-b026-c20a8aac1585",
"variables": {
"homeAddress": "chengdu"
}
}'
2、请求参数
Header 参数
名称 | 类型 | 必选 | 中文名 | 说明 |
---|---|---|---|---|
token | string | 是 | none | agent token,可以在页面集成-API-API Key获取 |
Body 参数
名称 | 类型 | 必选 | 中文名 | 说明 |
---|---|---|---|---|
queryText | string | 否 | 用户问题 | 请求的问题,比如示例中的:你好 |
sessionId | string | 否 | 会话id | 首轮可以为空(如果首轮传了,后续需要使用首轮传的。),首轮会返回sessionId,后续对话需使用返回的sessionId。 |
variables | object | 否 | 变量 | Map格式,key 是变量名称,value是变量值。对话中使用的变量,如果传了会覆盖当前中对话中已有的变量值 |
topicId | string | 否 | 主题id | 对话测试时使用,执行指定的topic,和nodeId配合使用 |
engines | array | 否 | 使用的对话引擎 | String类型,FAQ("faq", "知识库-FAQ"),DOC_QA("docQa", "知识库-文档问答"),TASK_FLOW("taskflow", "流程画布"),TASK_BASED("task_based", "意图识别"),为null 或taskflow是支持所有引擎 |
startId | string | 否 | 节点id | 对话测试时使用,执行指定的节点id。和topicId配合使用 |
3、返回响应
返回结果不是上述流式中多次返回的组合,而是一起返回,如下列示例。
数据结构
名称 |
类型 |
必选 |
中文名 |
说明 |
---|---|---|---|---|
sessionId | string | 是 | 会话ID | 用于标识本轮会话的唯一ID |
queryId | string | 是 | 查询ID | 用于标识本次会话的唯一ID |
replyStatus | integer | 是 | 回复状态 | 回复状态,默认成功SUCCESS(200, "成功");FAIL(4008001, "失败"); |
answer | array | 是 | 回答列表 | 包含各个回答块的数组 |
→ chunkId | integer | 是 | 流式chunkId | 流式chunkId |
→ status | string | 是 | 流式返回数据状态 | RUNNING("running");DONE("done"); |
→ topicId | string | 否 | 主题ID | 对应的主题ID |
→ blockId | string | 否 | 区块ID | 对应的区块ID |
→ nodeId | string | 否 | 节点ID | 对应的节点ID |
→ reply | object | 否 | 回复 | 包含回复相关详细信息的对象 |
→ → type | integer | 是 | 回复类型 | 1 (文本)3(富文本)8(列表) |
→ → text | string | 是 | 文本 | 文本/富文本答案 |
→ → textList | array | 否 | 文本列表 | 回复的文本列表 |
→ → clarifyGuide | string | 否 | 澄清指南 | 提供澄清相关的指南和信息 |
→ → replySource | string | 是 | 回复来源 | FAQ("faq", "知识库-FAQ"),DOC_QA("docQa", "知识库-文档"),TEXT_REPLY("text", "文本回复"),INTENT_CLARIFY("intentClarify", "意图澄清"),LARGE_MODEL_REPLY("largeModelReply", "大模型回复"),COLLECT_SLOT_ENTITY("collectSlotEntity", "收集槽位实体"),CHITCHAT("chitchat", "闲聊"),UNMATCHED("unmatch", "未匹配固定话术"),SENSITIVE("sensitive", "敏感拒答话术"),SYSTEM("system", "系统异常"),INSTRUCTION("instruction", "指令"); |
→ → showDocumentSource | boolean | 否 | 显示文档源 | 是否显示文档来源 |
→ → documents | array | 是 | 文档 | 知识问答信息,replySource是DOC_QA 该字段有值 |
→ → → document_id | string | 是 | 文档ID | 文档的唯一标识符 |
→ → → document_name | string | 是 | 文档名 | 文档的名称 |
→ → → knowledge_type | string | 是 | 文档类型 | 文档类型:doc 普通文档, web 网页知识 |
→ → → web_url | string | 是 | 文档链接 | 文档链接,当knowledgeType 是 web 时有值 |
→ → → data | array | 是 | 数据 | 文档的数据内容 |
→ → → → segment_id | string | 是 | 段落ID | 段落的唯一标识符 |
→ → → → segment_content | string | 是 | 段落内容 | 段落的文本内容 |
→ → → → score | string | 是 | 得分 | 段落相关性得分 |
→ → → → segment_coord | string | 是 | 段落坐标 | 段落在文档中的位置坐标 |
→ → → → data | array | 是 | 数据 | 段落中的句子数据 |
→ → → → → sentence_id | string | 是 | 句子ID | 句子的唯一标识符 |
→ → → → → sentence_content | string | 是 | 句子内容 | 句子的文本内容 |
→ → → → → score | string | 是 | 得分 | 句子相关性得分 |
→ → docDebug | object | 否 | 文档调试 | 提供文档调试相关信息,replySource是DOC_QA 该字段有值 |
→ → faqSearch | array | 否 | FAQ搜索 | faq 检索信息,replySource是FAQ 该字段有值 |
→ → slotCollectInfo | object | 否 | 槽收集信息 | 收集槽信息 |
→ → → waitCollectResultList | array | 是 | 待收集结果列表 | 列出待收集的结果 |
→ → → → name | string | 是 | 名称 | 待收集的槽名称 |
→ → → → result | string | 是 | 结果 | 已收集的结果 |
→ → → → option | array | 否 | 可选值 | 可选的答案 |
→ → → → optionSize | integer | 否 | 选项数量 | 选项数量 |
→ → → → clarity | string | 否 | 清晰度 | 澄清话术 |
→ → → → inputExample | string | 是 | 输入示例 | 输入的示例 |
→ → → → outputExample | string | 是 | 输出示例 | 输出的示例 |
→ → → hasCollectResultList | array | 是 | 已收集结果列表 | 列出已收集的结果 |
instruction | object | 否 | 指令 | 发出指令后有值,指令详细信息 Map<String, Map<String, String>>, 外层key为指令标识,value为指令参数map |
variables | object | 是 | 变量 | Map<String, Object>存储会话期间的各种变量信息 |
endTime | string | 否 | 结束时间 | 会话结束时间 |
recommendList | array | 是 | 推荐列表 | 提供可能的操作或信息的推荐列表 |
rewriteQuery | string | 是 | 重写查询 | 用户输入的重写版本 |
intent | array | 是 | 意图 | 列出此次会话涉及的意图 |
→ _effect | integer | 是 | 影响 | 表示此意图的效果 |
→ 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 | 是 | 无响应 | 是否未响应 |
4、返回示例
{
"time": 1715169513855,
"data": {
"sessionId": "3b86845a-94c0-4120-a961-79ce479e2773",
"queryId": "7641ef40-e741-43cb-b0b5-59d86f3a6abe",
"replyStatus": 200,
"answer": [
{
"chunkId": 0,
"status": null,
"topicId": null,
"blockId": null,
"nodeId": "start00000000000000000000",
"reply": null,
"instruction": null
},
{
"chunkId": 1,
"status": null,
"topicId": "a52cce91-f235-4c6e-96b0-fdb026c0c09c",
"blockId": null,
"nodeId": "3rkayHkJR_9gQ707XXmnfEuVmhvyir4eYJiL",
"reply": null,
"instruction": null
},
{
"chunkId": 2,
"status": null,
"topicId": "a52cce91-f235-4c6e-96b0-fdb026c0c09c",
"blockId": "3rkayHkJR_9gQ707XXmnfEuVmhvyir4eYJiL",
"nodeId": "kJ_HMFObG5uGwRaoqG3synofT5PVZYoXk3Zy",
"reply": {
"type": 1,
"text": "这是一个文本",
"textList": null,
"clarifyGuide": null,
"replySource": "TEXT_REPLY",
"showDocumentSource": null,
"documents": null,
"docDebug": null,
"faqSearch": null,
"slotCollectInfo": null,
"instruction": null
},
"instruction": null
}
],
"variables": {
"date": "2024-05-08",
"last_intent": "",
"week": "3",
"last_task_prompt": "这是一个文本",
"time": "19:58:33",
"last_response": "这是一个文本",
"last_user_response": ""
},
"endTime": "2024-05-08 19:58:33",
"recommendList": [],
"rewriteQuery": null,
"intent": null
},
"code": 200,
"msg": "OK"
}
对话结束接口
对话的上下文状态默认保留30分钟,调用该接口可结束对话状态
Base URL: https://keyue.cloud.baidu.com/online
接口后缀: /core/v5/end
请求方式:POST
Authentication:token为API Key
1、Curl 请求示例
curl --location 'https://keyue.cloud.baidu.com/online/core/v5/end'
--header 'token: xxxx'
--header 'Content-Type: application/json'
--data '{
"sessionId": "ecb95fcc-0e49-4ab0-b026-c20a8aac1585"
}'
2、请求参数
Header 参数
名称 | 类型 | 必选 | 中文名 | 说明 |
---|---|---|---|---|
token | string | 是 | none | agent token,可以在页面集成-API-API Key获取 |
Body 参数
名称 | 类型 | 必选 | 中文名 | 说明 |
---|---|---|---|---|
sessionId | string | 是 | 会话ID | 用于标识本轮会话的唯一ID,传入需要结束对话的sessionId |
3、返回响应
数据结构
名称 | 类型 | 必选 | 中文名 | 说明 |
---|---|---|---|---|
time | integer | 是 | 时间 | 时间戳 |
data | object | 是 | 数据 | 数据 |
→end | boolean | 是 | 对话是否结束 | true代表结束对话成功, false代表结束对话失败 |
code | integer | 是 | 状态码 | 200为成功 |
msg | string | 是 | 状态信息 | OK为正常 |
4、返回示例
{
"time": 1713927667141,
"data": {
"end": true
},
"code": 200,
"msg": "OK"
}