Prompt评估总结
更新时间:2024-02-23
功能介绍
本接口用于针对Prompt推理评分结果进行总结提炼。
注意事项
- 鉴权机制,调用本文API,使用“安全认证/Access Key ”中的Access Key ID 和 Secret Access Key等鉴权,无法使用获取Access Token的方式鉴权,具体鉴权认证机制参考“百度云鉴权认证机制”。
请求说明
基本信息
请求地址: https://qianfan.baidubce.com/wenxinworkshop/prompt/evaluate/summary
请求方式: POST
Header参数
名称 | 类型 | 必填 | 描述 |
---|---|---|---|
Content-Type | string | 是 | 固定值application/json |
x-bce-date | string | 否 | 当前时间,遵循ISO8601规范,格式如2016-04-06T08:23:49Z |
Authorization | string | 是 | 用于验证请求合法性的认证信息,更多内容请参考鉴权认证机制,签名工具可参考IAM签名工具 |
Body参数
名称 | 类型 | 必填 | 描述 |
---|---|---|---|
data | array[data] | 是 | Prompt信息、场景相关信息和对应推理结果 |
data说明
名称 | 类型 | 必填 | 描述 |
---|---|---|---|
prompt | string | 是 | 原始prompt |
scene | array[scene] | 是 | 多场景相关信息 |
response_list | array[string] | 是 | 该场景下不同推理结果返回 |
scene说明
名称 | 类型 | 必填 | 描述 |
---|---|---|---|
variables | object | 否 | prompt中的变量, 如果有需要填入。示例:"variables": {"formula": "45+43"} |
expected_target | string | 是 | 场景目标生成结果 |
response | string | 是 | 推理结果 |
new_prompt | string | 是 | prompt中变量替换为实际值后的结果 |
variables说明
名称 | 类型 | 必填 | 描述 |
---|---|---|---|
变量名1 | string | 否 | 变量值1,示例 {"formula": "45+43"} |
变量名2 | string | 否 | 变量值2 |
变量名n | string | 否 | 变量值n |
响应说明
名称 | 类型 | 描述 |
---|---|---|
log_id | string | 操作记录id |
result | object | 返回结果 |
status | int | 状态码 |
success | bool | 是否操作成功,说明:true:成功false:失败 |
result说明
名称 | 类型 | 描述 |
---|---|---|
responses | array[response] | 返回结果 |
response说明
名称 | 类型 | 描述 |
---|---|---|
response | string | 总结结果 |
id | string | 日志id |
errorCode | int | 错误码 |
errorMsg | string | 错误消息 |
示例
请求示例
# 替换下列示例中的Authorization值、x-bce-date值
curl -i --location 'https://qianfan.baidubce.com/wenxinworkshop/prompt/evaluate/summary'\
--header 'Authorization: bce-auth-v1/f0ee7axxxx/2023-09-19T13:42:13Z/180000/host;x-bce-date/9a8cfb8ee58a8f4xxxxxxx080016e374525543'\
--header 'x-bce-date: 2023-09-19T13:37:10Z'\
--header 'Content-Type: application/json'\
--data '{
"data":[
{
"prompt":"请帮我计算一下{formula}等于多少?只返回计算结果",
"scene":[
{
"variables":{
"formula":"45+43"
},
"expected_target":"88",
"response":"计算结果为: 45+43=88",
"new_prompt":"请帮我计算一下45+43等于多少?只返回计算结果"
}
],
"response_list":[
"response1",
"response2"
]
}
]
}'
响应示例
{
"log_id": "9ih8evsperpdvkxk",
"result": {
"responses": [
{
"response": "response",
"id": "",
"errorCode": 0,
"errorMsg": ""
}
]
},
"status": 200,
"success": true
}
错误码
若请求错误,服务器将返回的JSON文本包含以下参数:
名称 | 描述 |
---|---|
error_code | 错误码 |
error_msg | 错误描述信息,帮助理解和解决发生的错误 |
例如Access Token失效返回:
{
"error_code": 110,
"error_msg": "Access token invalid or no longer valid"
}
更多千帆大模型平台其他错误码,也可以查看错误码说明。