获取回答引用知识
最新更新:2024-03-01

获取回答引用知识

获取 Bot 回答所引用的知识库数据。

请求方式

GET

调用地址

https://api.gptbots.ai/v1/correlate/dataset

调用验证

详情参见 API 概述的鉴权方式说明。

请求

请求示例

curl -X GET -H 'Authorization: Bearer your_apikey' "https://api.gptbots.ai/v1/correlate/dataset?message_id=65e04591a0e1e42392696d78"
          curl -X GET 
    -H 'Authorization: Bearer your_apikey' 		
    "https://api.gptbots.ai/v1/correlate/dataset?message_id=65e04591a0e1e42392696d78"

        
此代码块在浮窗中显示

请求头

字段 类型 描述
Authorization Bearer ${token} 使用Authorization: Bearer ${token}进行调用验证,请在 API 密钥页面获取密钥作为token
Content-Type application/json 数据类型,取值为application/json

请求体

字段 类型 必填 描述
message_id string true Bot 回复的消息 ID。

响应

响应示例

{ "conversation_id": "65dc320df07244300b25b993", "question_id": "65dc323ef07244300b25b9c5", "answer_id": "65dc323ef07244300b25b9c6", "correlate_dataset": [ { "content": "[中国的历史]中国第一位女皇帝是武则天。", "data_id": "65dc3234f07244300b25b9b9", "data_name": "中国的历史", "source_url": "https://www.example.com/chinese-history", "score": 0.93492633 } ] }
          {
    "conversation_id": "65dc320df07244300b25b993",
    "question_id": "65dc323ef07244300b25b9c5",
    "answer_id": "65dc323ef07244300b25b9c6",
    "correlate_dataset": [
        {
            "content": "[中国的历史]中国第一位女皇帝是武则天。",
            "data_id": "65dc3234f07244300b25b9b9",
            "data_name": "中国的历史",
            "source_url": "https://www.example.com/chinese-history",
            "score": 0.93492633
        }
    ]
}

        
此代码块在浮窗中显示

成功响应

字段 类型 描述
conversation_id string 会话 ID
question_id string 问题 ID
answer_id string Bot 回答 ID
correlate_dataset JSON Array 引用的知识数据
content string 知识切片内容
data_id string 知识文档 ID
data_name string 知识文档名称
source_url string 知识文档来源 URL
score string 知识切片与问题的语义相关性

失败响应

字段 类型 描述
code int 错误码。
message string 错误详情。

错误码

Code Message
40000 参数错误
40379 积分不足
200222 Bot 不支持文档相关性
40378 Bot 已删除
20055 禁止使用 API 功能
40127 开发者鉴权失败