智慧图问
开发环境
http://dev-cn.your-api-server.com
开发环境
http://dev-cn.your-api-server.com
POST
https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/plugin/{服务后缀名称}/
功能介绍
服务后缀名称说明


请求示例(流式)
响应示例(流式)
# 首包需要的回显信息
data: {'plugin_id': 'uuid-chatocr', 'requests': {'query': '通知书上的大学是什么?', 'filename': '通知书.jpeg'}, 'response': {'error_no': 0, 'error_msg': 'success', 'format': 'json', 'result': {'llm_result': '根据提供的图像文字信息,通知书上的大学是“某某大学”。', 'ocr_result': [{'rect': {'left': 399, 'top': 304, 'width': 291, 'height': 92}, 'word': '某某大学'}, {'rect': {'left': 206, 'top': 509, 'width': 687, 'height': 118}, 'word': '录取通知书'}]}}}
# 后续为用户请求的响应结果
data: {'id': 'as-rpf9gsgffn', 'object': 'chat.completion', 'created': 1694434293, 'sentence_id': 0, 'is_end': False, 'is_truncated': False, 'result': '根据提供的图像文字信息,通知书上的大学是“某某大学”。', 'need_clear_history': False, 'usage': {'prompt_tokens': 563, 'completion_tokens': 9, 'total_tokens': 572}}
错误码
名称 | 描述 |
---|---|
error_code | 错误码 |
error_msg | 错误描述信息,帮助理解和解决发生的错误 |
{
"error_code": 110,
"error_msg": "Access token invalid or no longer valid"
}
错误码 | 错误信息 | 描述 |
---|---|---|
0 | 正常 | 正常 |
216100 | 请求参数错误 | 请求参数错误 |
216400 | 服务处理异常错误 | 服务处理异常错误 |
216203 | 图片处理失败 | 图片处理失败 |
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/plugin//?access_token =' \
--header 'Content-Type: application/json' \
--data-raw '{
"query": "string",
"plugins": [
"string"
],
"stream": true,
"llm\t": {},
"input_variables": {},
"history\t": {},
"verbose\t": true
}'
响应示例响应示例
{
"id": "as-k4r8wt8xr8",
"object": "chat.completion",
"created": 1692174171,
"result": "根据提供的图像文字信息,通知书上的大学是“某某大学”。",
"is_truncated": false,
"need_clear_history": false,
"usage": {
"prompt_tokens": 190,
"completion_tokens": 27,
"total_tokens": 217
},
"meta_info": {
"requests": {
"query": "通知书上的大学是什么?",
"filename": "通知书.jpeg"
},
"response": {
"error_no": 0,
"error_msg": "success",
"format": "json",
"result": {
"llm_result": "根据提供的图像文字信息,通知书上的大学是“某某大学”。",
"ocr_result": [
{
"rect": {
"left": 399,
"top": 304,
"width": 291,
"height": 92
},
"word": "某某大学"
},
{
"rect": {
"left": 206,
"top": 509,
"width": 687,
"height": 118
},
"word": "录取通知书"
}
]
},
"logid": 2796978908
}
}
}
请求参数
Path 参数
服务后缀名称
string
必需
Query 参数
access_token
string
必需
Body 参数application/json