mirror of
https://github.com/alibaba/higress.git
synced 2026-05-23 04:07:26 +08:00
AI-search plugin supports controlling through the web_search_options parameter. (#1893)
This commit is contained in:
@@ -11,12 +11,13 @@ description: higress 支持通过集成搜索引擎(Google/Bing/Arxiv/Elastics
|
||||
## 运行属性
|
||||
|
||||
插件执行阶段:`默认阶段`
|
||||
插件执行优先级:`440`
|
||||
插件执行优先级:`460`
|
||||
|
||||
## 配置字段
|
||||
|
||||
| 名称 | 数据类型 | 填写要求 | 默认值 | 描述 |
|
||||
|------|----------|----------|--------|------|
|
||||
| defaultEnable | bool | 选填 | true | 插件功能默认是否开启。设置为false时,仅当请求中包含web_search_options字段时才启用插件功能 |
|
||||
| needReference | bool | 选填 | false | 是否在回答中添加引用来源 |
|
||||
| referenceFormat | string | 选填 | `"**References:**\n%s"` | 引用内容格式,必须包含%s占位符 |
|
||||
| defaultLang | string | 选填 | - | 默认搜索语言代码(如zh-CN/en-US) |
|
||||
@@ -242,6 +243,22 @@ searchRewrite:
|
||||
timeoutMillisecond: 15000
|
||||
```
|
||||
|
||||
### 按需启用插件配置
|
||||
|
||||
配置插件仅在请求中包含`web_search_options`字段时才启用:
|
||||
|
||||
```yaml
|
||||
defaultEnable: false
|
||||
searchFrom:
|
||||
- type: google
|
||||
apiKey: "your-google-api-key"
|
||||
cx: "search-engine-id"
|
||||
serviceName: "google-svc.dns"
|
||||
servicePort: 443
|
||||
```
|
||||
|
||||
这种配置适用于支持web_search选项的模型,例如OpenAI的gpt-4o-search-preview模型。当请求中包含`web_search_options`字段时,即使是空对象(`"web_search_options": {}`),插件也会被激活。
|
||||
|
||||
## 注意事项
|
||||
|
||||
1. 提示词模版必须包含`{search_results}`和`{question}`占位符,可选使用`{cur_date}`插入当前日期(格式:2006年1月2日)
|
||||
|
||||
Reference in New Issue
Block a user