前言¶
DSH 中面向模型的 web_search 通常从 dsh-tool-web 进入 ctx.web.search(),再落到一个已注册的搜索 provider。已发布的 web-search-deepseek provider 只处理 Anthropic 兼容的 /messages API 和 web_search_20250305。
如果你的自定义模型走 OpenAI Responses 端点,并且该端点本身支持内置 web_search,单靠普通配置还不能把 DSH 的搜索请求转到这个端点。dsh-web-search-responses 就是为这个场景提供的 DSH ctx.web 搜索 provider。
这是什么¶
dsh-web-search-responses 是 herminger 维护的 DSH 插件,许可证为 MIT。
它注册一个名为 responses-web 的搜索 provider,让 ctx.web.search() 复用当前会话模型使用的 Responses API 端点,并发送内置 web_search 请求。
核心能力¶
下面介绍这个插件已核实的主要能力:
- 注册
responses-webprovider,向会话模型使用的 Responses API 端点发送web_search请求。 - 使用
type为web_search的tools与tool_choice。 - 解析响应中的
web_search_call项与消息引用,并转换回 DSH 标准WebSearchResult。 - 默认自动跟随当前模型/路由,也可以显式固定
llm-pi-ai路由。 - 支持配置
provider、model、baseURL、apiKeyEnv、includeSources、searchContextSize、toolChoice、maxOutputTokens。
安装与启用¶
从 GitHub 安装¶
从 GitHub 安装推荐要求 pnpm 在 PATH 上。先确认 pnpm 可用,再执行:
dsh plugin --profile web add github:herminger/dsh-web-search-responses
如果之前安装过本地链接副本,并想切换到 GitHub 源,先移除旧安装,再执行 GitHub 安装:
dsh plugin --profile web remove dsh-web-search-responses
dsh plugin --profile web add github:herminger/dsh-web-search-responses
从本地检出安装¶
如果你已有本地检出,可以直接添加本地路径:
dsh plugin --profile web add /path/to/dsh-web-search-responses
如果没有 pnpm,也可以先用 patch 做快速测试。overlay.patch.yml 需要与 index.mjs 同目录,或者使用绝对路径:
dsh --profile web --patch /path/to/overlay.patch.yml
安装或变更后,完全重启 dsh web,让新 bundle 生效。
典型用法¶
默认情况下,这个 provider 会自动跟随当前模型:
provider和model可以来自执行 agent、DSH 默认模型,或唯一配置的llm-pi-aiResponses 路由。baseURL和apiKeyEnv可以来自该路由的llm-pi-ai设置。
如果要显式固定路由,可以编辑 profile 的 cordis.patch.yml,把 id 为 web-search-responses 的 provider 固定为 cpa:
- id: web-search-responses
config:
provider: cpa
常用配置项如下:
| 字段 | 含义 | 默认值 |
|---|---|---|
provider |
要复用的 llm-pi-ai 路由 |
当前模型路由 |
model |
搜索请求使用的模型 | 当前模型 |
baseURL |
Responses 端点前缀,会自动追加 /responses |
路由 baseURL |
apiKeyEnv |
凭据引用,例如 CPA_API_KEY |
路由 apiKeyEnv |
includeSources |
是否发送 include: ["web_search_call.action.sources"] |
false |
searchContextSize |
low / medium / high |
未设置 |
toolChoice |
{ type: "web_search" } 或 "required" |
{ type: "web_search" } |
maxOutputTokens |
搜索请求的输出 token 上限 | 4096 |
排障¶
configured web provider "responses-web" is registered but unavailable:通常是插件 config 被解析为 YAMLnull,例如空config:。更新到最新index.mjs,其中会对config ?? {}做归一化,然后重启 DSH。Responses API returned no web_search_call item:说明该端点/模型实际不支持内置web_search工具。no API key for "...":检查路由的apiKeyEnv,以及 DSH 中保存的凭据。
适用场景与注意¶
这个插件适合会话模型的 Responses 端点已经支持内置 web_search 的场景。通过它,DSH 的 ctx.web 搜索请求可以直接复用当前会话模型使用的端点,而不再依赖 Anthropic Messages 兼容的搜索 provider。
安装前建议检查源码与 MIT 许可证。插件会在当前 dsh 进程权限下运行,涉及 API key、路由、模型和网络请求时,应确认这些配置符合预期。
参考¶
GitHub 仓库:https://github.com/herminger/dsh-web-search-responses
目录页可通过插件名 dsh-web-search-responses 检索。