点赞点踩
更新时间:2025-04-17
POST
https://qianfan.baidubce.com/v2/app/conversation/feedback
此接口支持对agent应用返回的对话内容进行评价(包括点赞、点踩及取消评价),并允许附加标签和评论文本,帮助进一步细化反馈数据。
权限说明
调用本API,需使用API Key鉴权方式。Authorization的值为Bearer <API Key>。获取API Key流程,请查看授权。
请求参数
Headers 参数
除公共头域外,无其它特殊头域
Body 参数
flag
array
点踩原因
可选
显示子属性
隐藏子属性
items
string
枚举值:
答非所问
内容缺失
没有帮助
逻辑问题
偏见歧视
事实错误
type
string
点赞点踩枚举值:
cancel:取消评论
upvote:点赞
downvote:点踩
必选
app_id
string
应用id
必选
reason
string
对于点踩额外补充的原因。
可选
message_id
string
对应的消息id
必选
conversation_id
string
对话id
必选
请求结构
POST /v2/app/conversation/feedback HTTP/1.1
HOST: qianfan.baidubce.com
Authorization: Bearer <API Key>
Content-Type: application/json
{
"app_id": "d00fb80d-c5a8-45df-ad33-e9c03572c5ac",
"conversation_id": "76a25d49-5c0e-4979-83ea-2f9903945801",
"message_id": "2793aaf6-3cd9-42d4-b87e-0d9eb82c7e52",
"type": "downvote",
"flag": ["答非所问"],
"reason": "回答内容和问题不相关"
}
示例代码
curl
curl --location 'https://qianfan.baidubce.com/v2/app/conversation/feedback' \
--header 'Authorization: Bearer <API Key>' \
--header 'Content-Type: application/json' \
--data '{
"app_id": "d00fb80d-c5a8-45df-ad33-e9c03572c5ac",
"conversation_id": "76a25d49-5c0e-4979-83ea-2f9903945801",
"message_id": "2793aaf6-3cd9-42d4-b87e-0d9eb82c7e52",
"type": "downvote",
"flag": ["答非所问"],
"reason": "回答内容和问题不相关"
}'
返回响应
Headers 参数
除公共头域外,无其它特殊头域
JSON
{
"request_id": "db50e6ed-ee0a-4d95-a385-6d57a05aed7b"
}
JSON
{
"code": "InvalidParameter",
"message": "'conversation_id' must be uuid",
"request_id": "0a7c7833-544b-4e82-9dc7-8a1047179ff3"
}