POST /web-search-agent/chat/completions HTTP/1.1 请求参数注意请求提供动态参数后将会直接覆盖应用配置中的状态值。参数名类型是否必须说明streambool是必须填 true当前版本仅支持流式响应。若提供false或不提供请求将失败inputobject是输入字段input.request\_idstr否请求ID业务自定义input.messagesarray\[object\]是对话消息input.messages.\[\].rolestr是角色枚举值为user、assistantinput.messages.\[\].contentstr是消息内容parametersobject是配置参数字段parameters.agent\_optionsobject是智能体专用参数parameters.agent\_options.agent\_idstring是应用IDparameters.agent\_options.agent\_versionstring是应用版本parameters.agent\_options.session\_knowledgestring否session 会话级别知识parameters.agent\_options.system\_promptstring否系统提示词parameters.agent\_options.agent\_policystring否执行策略 - standard: 默认策略推荐 - agentic: 强制边想边搜 - turbo: 极速模式parameters.agent\_options.forced\_searchbool否是否强制搜索 - 开启时 agent\_policy默认为 standardparameters.agent\_options.enable\_citationbool否是否透出引用信息parameters.agent\_options.enable\_text\_image\_mixedbool否是否图文并茂生成parameters.agent\_options.enable\_lemmabool否是否透出百科词条parameters.agent\_options.related\_videobool否是否透出相关视频parameters.agent\_options.enable\_rec\_questionbool否是否透出相关问题parameters.agent\_options.show\_step\_infobool否是否展示工具调用状态信息默认为 falseparameters.agent\_options.locationobject否请求位置信息parameters.agent\_options.location.addressstring否具体地址parameters.agent\_options.location.provincestring否省份parameters.agent\_options.location.citystring否城市parameters.agent\_options.location.districtstring否区/县parameters.agent\_options.location.longitudestring否经度小数点6位parameters.agent\_options.location.latitudestring否维度小数点6位返回参数参数名类型是否必须说明request\_idstr是请求IDdashscope 平台codestr是状态码成功200messagestr是状态信息outputobject是输出字段output.request\_idstr否请求ID业务自定义output.choicesarray\[object\]是模型输出信息output.choices.\[\].finish\_reasonstr是生成结束原因仅尾包输出stopoutput.choices.\[\].messageobject是对话消息output.choices.\[\].message.rolestr是角色枚举值为user、assistant、tooloutput.choices.\[\].message.contentstr | array\[object\]是生成内容/工具返回内容output.choices.\[\].message.reasoning\_contentstr否思考内容output.choices.\[\].message.tool\_callsarray\[object\]否工具调用信息output.choices.\[\].message.tool\_calls\[0\].argumentsdcit\[str,object\]否工具调用参数output.choices.\[\].message.tool\_calls\[0\].namestr否工具调用名称output.choices.\[\].message.additional\_kwargs.extra\_jsonAny否工具调用返回时携带结构化输出信息output.choices.\[\].message.extradict否步骤状态信息output.choices.\[\].message.extra.groupstr否执行阶段output.choices.\[\].message.extra.step\_changestr否步骤变化事件output.choices.\[\].message.extra.stepstr否当前步骤output.choices.\[\].message.response\_metadatadict否请求模型调用详细信息output.usageobject否用量统计output.usage.input\_tokensint否输入 tokensoutput.usage.output\_tokensint否输出 tokensoutput.usage.total\_tokensint否总 tokens执行阶段枚举执行阶段group描述说明planning计划中对应plan模型即系统处于任务规划阶段该阶段包含 start 和 end 事件generating生成中对应生成模型表示系统正处于结果生成阶段此阶段包含 start 和 end 事件。当前步骤step描述和说明planning计划中generating生成中tool\_calling工具调用中tool\calling\{工具名称}工具调用中附带工具名称由于模型原因 step_change 值可能为不存在请尽可能使用持久化的标志step空包情况下 step、step_change、group 字段的值可能不存在plan、generation 均由 xxx_start 事件 和 xxx_end 事件两个事件组成tool_call 由 tool_call_start、tool_calling、tool_return 三个事件组成tool_call_start 表示工具调用开始、tool_calling 表示获取到完整工具调用的参数并会抛出完整的工具调用参数、tool_return 表示工具调用返回结果同时会携带结构化的工具返回信息。事件发生时step的值步骤变化事件 (step_change)事件名称解释说明planningplan\_start开始规划step状态变为planning, 表示对应状态的开头包含当前包。planning空规划中表示正在思考和工具调用planningplan\_end结束规划step开始变成其他状态事件发生时step仍为planning表示对应状态的结尾包含当前包。generatinggeneration\_start开始生成与plan事件同理generating空生成中表示正在生成generatinggeneration\_end结束生成与plan事件同理tool_calling_{工具名称}tool\_call\_start开始工具调用表示工具调用开始tool_calling_{工具名称}tool\_calling工具调用中会输出tool\_call的具体参数和工具名称tool_calling状态变为tool_calling_{工具名称}。tool_calling_{工具名称}tool\_return工具返回会携带工具返回信息step开始变成其他状态事件发生时step仍为tool_calling_{工具名称}。Agent tool call message和工具名映射当有工具调用时在消息中的[extra][step]字段中会显示“tool_calling_xx”显示正在调用的工具是什么。具体消息中的工具调用消息和实际的工具名的映射关系如下表所示。文本问答工具调用的 step 消息工具名tool\_calling\_search联网搜索tool\_calling\_visit网页阅读tool\_calling\_video\_search视频搜索tool\_calling\_lemma\_search百度词条tool\_calling\_query\_suggesting追问多模态问答相比于文本问答新增了 2 个工具图搜图文搜图。工具调用的 step 消息工具名tool\_calling\_image\_search文搜图tool\_calling\_image\_to\_image\_search图搜图本地生活 POI 工具工具调用的 step 消息工具名tool\_calling\_poi\_search关键字搜索tool\_calling\_around\_search周边搜索工具调用状态信息参数工具调用的状态在消息中的[extra][step_change]字段中工具调用的信息在[extra][step_info]中工具调用状态和工具调用信息的映射如下工具调用的 step 状态状态含义工具调用状态信息 step\_infotool\_call\_start开始工具调用开始调用 xxx 工具tool\_calling正在调用工具正在调用 xxx 工具tool\_calling\_return工具调用完成xxx 工具调用完成xxx以联网搜索工具为例其工具调用的状态信息会经历如下这个状态step_change: tool_call_start, step: tool_calling_search,step_info: 开始调用联网检索工具 step_change: tool_calling, step: tool_calling_search,step_info: 正在调用联网检索工具 step_change: tool_return, step: tool_calling_search, step_info: 联网检索工具调用完成检索到10个网页图文并茂消息协议在开启图文并茂后模型输出的消息中会穿插图片图片在消息正文中的为 html 标准图片格式示例如下img src\xxx\ data-type\image\ data-url\xxx\ data-title\台风后的杭州:蓝天白云如漫画般清新️\ alt\杭州 晴天 蓝天\ width\1080\ height\1410\标签中data-type数据类型image 为图片数据src 图片的 url 地址data-url 图片的来源网址data-tile 图片标题width/height 图片的尺寸宽和高在包含图片的模型消息中additional_kwargs 字段中包含了如下两个字段data_type如果为图文并茂的图片消息则值为 imagedata_json包含当前内容相关的所有图片正文中只显示一张。这里是所有相关图片的集合数据类型为 json。在 data_json 中每张图片的消息体如下所示idx图片编号 idurl图片来源网址title图片标题published网址发布日期image_info[url]图片网址image_info[width]图片宽image_info[height]图片高{idx: 15, query: 杭州 晴天 蓝天, url: xxx, title: xx, published: 2024-11-04 03:04:04, image_info: {url: xxx, width: 1080, height: 1410}}以下展示了图文并茂消息完整的 3 个消息包示例data: { status_code: 200, code: , message: , output: { choices: [ { finish_reason: , message: { content: 游玩。\n\n, additional_kwargs: {}, response_metadata: {}, type: ai, name: null, id: run--019e63e4-e728-7421-b3e5-57b408d6d4b0, example: false, tool_calls: [], invalid_tool_calls: [], usage_metadata: null, tool_call_chunks: [], reasoning_content: , role: assistant, extra: { group: generating, step_change: , step: generating } } } ] }, usage: null, request_id: chenwen-test-web-search-01 } data: { status_code: 200, code: , message: , output: { choices: [ { finish_reason: , message: { content: img src\http://miaobi-lite.bj.bcebos.com/miaobi/5mao/b%275Y%2Bw6aOO6L%2BH5ZCO55qE5Zu%2B54mHXzE3MzA2NTY4MTMuMTQ0MDA1NQ%3D%3D%27/0.png\ data-type\image\ data-url\http://mbd.baidu.com/newspage/data/dtlandingsuper?niddt_4158884509151638702\ data-title\台风后的杭州:蓝天白云如漫画般清新\ alt\杭州 晴天 蓝天\ width\1080\ height\1410\\n\n\n, additional_kwargs: { data_type: image, data_json: [ { idx: 15, query: 杭州 晴天 蓝天, url: http://mbd.baidu.com/newspage/data/dtlandingsuper?niddt_4158884509151638702, title: 台风后的杭州:蓝天白云如漫画般清新, published: 2024-11-04 03:04:04, image_info: { url: http://miaobi-lite.bj.bcebos.com/miaobi/5mao/b%275Y%2Bw6aOO6L%2BH5ZCO55qE5Zu%2B54mHXzE3MzA2NTY4MTMuMTQ0MDA1NQ%3D%3D%27/0.png, width: 1080, height: 1410 } }, { idx: 16, query: 杭州 晴天 蓝天, url: http://m.dianping.com/ugcdetail/175828244?sceneType0bizType29msourcebaiduappugc, title: 杭州的天空也太美了吧!, published: 2023-07-26 00:00:00, image_info: { url: http://qcloud.dpfile.com/pc/VWohABccM5j2sRMTT4YdH7qapT46U8bLlM3Wp-xKeMm3OVoihIkmurvV3052Y9Xt.jpg, width: 2048, height: 2731 } }, { idx: 17, query: 杭州 晴天 蓝天, url: http://m.dianping.com/ugcdetail/175964222?sceneType0bizType29msourcebaiduappugc, title: 杭州蓝天白云很美,只是每次去人都要晒黑两, published: 2023-07-27 00:00:00, image_info: { url: http://qcloud.dpfile.com/pc/6ScKLghe1ZcE15OpzbomPigY1VkO6o_UTx9z6UB_BoNtf5OGAsnbF-AFIAJjozRl.jpg, width: 2048, height: 2731 } } ] }, response_metadata: {}, type: ai, name: null, id: run--019e63e4-e728-7421-b3e5-57b408d6d4b0, example: false, tool_calls: [], invalid_tool_calls: [], usage_metadata: null, tool_call_chunks: [], reasoning_content: , role: assistant, extra: { group: generating, step_change: , step: generating } } } ] }, usage: null, request_id: chenwen-test-web-search-01 } data: { status_code: 200, code: , message: , output: { choices: [ { finish_reason: , message: { content: **总结**, additional_kwargs: {}, response_metadata: {}, type: ai, name: null, id: run--019e63e4-e728-7421-b3e5-57b408d6d4b0, example: false, tool_calls: [], invalid_tool_calls: [], usage_metadata: null, tool_call_chunks: [], reasoning_content: , role: assistant, extra: { group: generating, step_change: , step: generating } } } ] }, usage: null, request_id: chenwen-test-web-search-01 }