新增干预项
更新时间:2026-02-09
POST
https://qianfan.baidubce.com/v2/ai_search/web_search/intervention
在调用百度搜索API进行联网搜索时,可设置一系列特定的用户输入,通过完全匹配、语义匹配或关键词匹配的方式命中后,进行联网搜索。
权限说明
调用本文API,需使用API Key鉴权方式。使用API Key鉴权调用API流程,具体调用流程,请查看认证鉴权。
请求参数
Headers 参数
除公共头域外,无其它特殊头域
Body 参数
query
string
问答query,不超过 256个字符
必选
query_match_strategy
object {3}
query匹配策略
必选
显示子属性
隐藏子属性
name
string
匹配策略:
exact - 完全匹配
semantic - 语义
keyword - 关键词匹配
可选
similarity_threshold
float
语义匹配阀值, 0~1 之间,默认 0.9
可选
keywords
string
关键词匹配时,设置用于匹配的关键词,长度不超过256
可选
result
object {1}
干预策略
必选
显示子属性
隐藏子属性
documents
array
预置回答策略
可选
显示子属性
隐藏子属性
items
object {18}
显示子属性
隐藏子属性
id
string
文档唯一标识
必选
url
string
文档URL地址
必选
title
string
文档标题
可选
date
string
网页发布时间
可选
content
string
文档正文内容
可选
icon
string
图标URL
可选
web_anchor
string
网页来源
可选
type
string
资源类型
可选
website
string
站点名称。
可选
snippet
string
摘要文本
可选
rerank_score
float
重排序分数
可选
authority_score
float
权威性分数
可选
markdown_text
string
Markdown格式文本
可选
is_aladdin
boolean
是否来自阿拉丁
可选
image
object {3}
图片信息
可选
显示子属性
隐藏子属性
url
string
图片链接。
可选
height
string
图片高度。
可选
width
string
图片宽度。
可选
video
object {6}
视频信息
可选
显示子属性
隐藏子属性
url
string
视频链接。
可选
height
string
视频高度。
可选
width
string
视频宽度。
可选
size
string
视频大小,单位Bytes。
可选
hover_pic
string
视频封面图。
可选
duration
string
视频长度,单位秒。
可选
web_extesions
object {1}
网页扩展信息
可选
显示子属性
隐藏子属性
images
array
网页相关图片
可选
显示子属性
隐藏子属性
items
object {3}
显示子属性
隐藏子属性
images[0].url
string
图片链接
可选
images[0].height
string
图片高度
可选
images[0].width
string
图片宽度
可选
请求结构
POST /v2/ai_search/web_search/intervention
Content-Type: application/json
Authorization: Bearer <API Key>
{
"query": "2026年春节放假时间",
"config_id": "",
"query_match_strategy": {
"name": "exact"
},
"result": {
"documents": [
{
"id": 1,
"url": "https://www.gov.cn/zhengce/content/2025-11/20/content_6968789.htm",
"title": "2026年春节放假安排通知",
"date": "2025-11-20",
"content": "2026年春节放假时间为2月10日至16日放假调休,共7天。2月8日(星期日)、2月17日(星期一)上班。",
"icon": "https://www.gov.cn/favicon.ico",
"web_anchor": "中国政府网",
"type": "web",
"website": "www.gov.cn",
"video": null,
"image": null,
"is_aladdin": false,
"aladdin": null,
"snippet": "2026年春节放假时间为2月10日至16日放假调休,共7天...",
"web_extensions": null,
"rerank_score": 0.98,
"authority_score": 0.95,
"markdown_text": "## 2026年春节放假安排\n\n2026年春节放假时间为2月10日至16日放假调休,共7天。2月8日(星期日)、2月17日(星期一)上班。"
},
{
"id": 2,
"url": "https://example.com/2026-spring-festival.jpg",
"title": "2026春节放假日历",
"date": "2025-11-21",
"content": "2026年春节放假日历高清版,包含调休安排和出行提示。",
"icon": "",
"web_anchor": "",
"type": "image",
"website": "",
"video": null,
"image": {
"url": "https://example.com/2026-spring-festival.jpg",
"height": "1080",
"width": "1920"
},
"is_aladdin": false,
"aladdin": null,
"snippet": "",
"web_extensions": {
"images": [
{
"url": "https://example.com/2026-spring-festival-1.jpg",
"height": "720",
"width": "1080"
}
]
},
"rerank_score": null,
"authority_score": null,
"markdown_text": ""
}
]
}
}
示例代码
请求示例
curl --location 'https://qianfan.baidubce.com/v2/ai_search/web_search/intervention ' \
--header 'Authorization: Bearer <API Key>' \
--header 'content-type: application/json' \
--data '
{
"query": "2026年春节放假时间",
"config_id": "",
"query_match_strategy": {
"name": "exact"
},
"result": {
"documents": [
{
"id": 1,
"url": "https://www.gov.cn/zhengce/content/2025-11/20/content_6968789.htm",
"title": "2026年春节放假安排通知",
"date": "2025-11-20",
"content": "2026年春节放假时间为2月10日至16日放假调休,共7天。2月8日(星期日)、2月17日(星期一)上班。",
"icon": "https://www.gov.cn/favicon.ico",
"web_anchor": "中国政府网",
"type": "web",
"website": "www.gov.cn",
"video": null,
"image": null,
"is_aladdin": false,
"aladdin": null,
"snippet": "2026年春节放假时间为2月10日至16日放假调休,共7天...",
"web_extensions": null,
"rerank_score": 0.98,
"authority_score": 0.95,
"markdown_text": "## 2026年春节放假安排\n\n2026年春节放假时间为2月10日至16日放假调休,共7天。2月8日(星期日)、2月17日(星期一)上班。"
},
{
"id": 2,
"url": "https://example.com/2026-spring-festival.jpg",
"title": "2026春节放假日历",
"date": "2025-11-21",
"content": "2026年春节放假日历高清版,包含调休安排和出行提示。",
"icon": "",
"web_anchor": "",
"type": "image",
"website": "",
"video": null,
"image": {
"url": "https://example.com/2026-spring-festival.jpg",
"height": "1080",
"width": "1920"
},
"is_aladdin": false,
"aladdin": null,
"snippet": "",
"web_extensions": {
"images": [
{
"url": "https://example.com/2026-spring-festival-1.jpg",
"height": "720",
"width": "1080"
}
]
},
"rerank_score": null,
"authority_score": null,
"markdown_text": ""
}
]
}
}'
返回响应
Headers 参数
除公共头域外,无其它特殊头域
返回参数
request_id
string
请求id
可选
响应示例
{"request_id": "123"}
