Repository navigation
feat(deepseek): support Responses web search - #1015
Merged
AAswordman merged 8 commits intoAug 27, 2026
Merged
AAswordman merged 8 commits into
AAswordman merged 8 commits into
Conversation
Contributor
Author
Contributor
Author
|
成本收益: 本PR的主要收益是借助支持DeepSeek的 responses api能够支持服务端工具调用,例如web_search,可以简化搜索工具的配置。 看过了关联的几个issue后发现在当前时间节点的收益不算特别强。#948 并且已经有多个方案能够支持DeepSeek的 response api 或者 web_search 能力
姑且停留在draft一段时间。看看后续DeepSeek的接口支持是否有变化,有更强的动力去推进这件事情 |
AAswordman
reviewed
Aug 22, 2026
AAswordman
left a comment
Owner
There was a problem hiding this comment.
整体思路和方向没有问题:通过端点选择 Responses/Chat 协议、保留服务端 web_search 的历史结构,并将服务端工具调用与本地工具执行路径分离,这个设计方向是合理的。后续继续补齐实现细节和验证证据即可。
nailuoGG
force-pushed
the
feat/deepseek-responses-server-tools
branch
2 times, most recently
from
August 24, 2026 07:02
28f8d18 to
2c13bc3
Compare
nailuoGG
marked this pull request as ready for review
August 24, 2026 07:08
nailuoGG
marked this pull request as draft
August 24, 2026 07:23
Contributor
Author
nailuoGG
marked this pull request as ready for review
August 24, 2026 10:56
Use the saved endpoint as the single protocol selector so released Chat Completions configurations keep their behavior and the runtime protocol cannot disagree with the address shown to the user. Enable optional server-side web search only for Responses requests. Preserve web_search_call output items for DeepSeek's stateless multi-turn history and retain function call IDs so client tool outputs remain paired across turns.
Server-side tools have already been executed by the model provider. They must be visible to users without entering Operit's local tool permission, authorization, or execution pipeline. Render validated web_search_call metadata as dedicated read-only records on Android and Web Chat. Keep local tool behavior unchanged and hide malformed or internal protocol metadata from normal message rendering.
Protect the protocol boundaries introduced by DeepSeek Responses: endpoint routing, released-config defaults, optional search declaration, output-item replay, and hidden metadata removal from copied content. Cover function call ID retention and call/output ordering so parallel tool results remain bound to the correct Responses calls while older records without call IDs keep their released behavior.
Record the compatibility contract across endpoint routing, optional search, stream events, stateless history replay, and the boundary between client tool execution and read-only server tool records. Keep the implementation sequence and verification notes available to future contributors so later provider and UI changes preserve the same protocol and userspace behavior.
Failing every 4xx immediately prevents repeated invalid requests, but it also disables the existing retry and key-rotation behavior needed for temporary request timeouts and rate limits. Keep deterministic client errors terminal while classifying 408 and 429 as retriable. Preserve their HTTP status on the exception so the existing delay, retry limit, and multi-key rate-limit handling continue to apply.
DeepSeek Responses rejects client-tool continuations when the preceding reasoning_text item is not returned. The adapter only persisted OpenAI encrypted reasoning metadata, so DeepSeek tool rounds lost the stateless reasoning history required by the API. - Thread provider identity through streaming and non-streaming Responses parsing. - Preserve DeepSeek reasoning item IDs and plaintext content in hidden metadata. - Replay reasoning before assistant messages, function calls, and tool outputs. - Remove duplicate rendered thinking content after successful replay. - Preserve the existing OpenAI encrypted reasoning metadata contract. - Add regression tests and protocol documentation. Validation: - 46 CI Python tests passed. - Repository hygiene, Markdown links, localization, and WebChat typecheck passed on a clean latest-development merge candidate. - OpenAIResponsesPayloadAdapterTest passed with JDK 21. - assembleDebug passed with JDK 21. - :app:testDebugUnitTest ran 1212 tests with 6 failures; latest development reproduced the same 6 failures in the corresponding 23-test baseline set.
nailuoGG
force-pushed
the
feat/deepseek-responses-server-tools
branch
from
August 26, 2026 10:22
1ce5758 to
6716593
Compare
This was referenced Sep 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.







变更说明 / Description
为 DeepSeek 增加由 API 端点驱动的 Responses API 支持,并接入服务端
web_search。现有/chat/completions配置继续使用 Chat Completions;只有将端点切换为/responses后才会进入 Responses 协议。本 PR 保留 Responses 无状态多轮请求所需的
web_search_call和函数工具调用结构,并将服务端已执行的工具记录与 Operit 本地工具的权限、执行链路分离。改动范围 / Scope
已包含 / Included
/chat/completions使用 Chat Completions,/responses使用 Responses API。web_search。{"type":"web_search"},保持tool_choice=auto。web_search_call,并保存、恢复多轮历史所需的原始 output item。No tool output found for tool call。AITool、权限确认或本地执行链路。web_search只读记录,严格处理action.query和action.queries,点击记录可查看完整 raw JSON。未包含与待跟进 / Out of scope and follow-ups
tool_choice=auto,模型可在服务端web_search与 Operit 本地工具之间自主选择,也可在同一轮混合使用。SERVER_TOOL_STARTED/SERVER_TOOL_COMPLETED旁路事件;搜索期间显示通用“正在接收回复”,完成后才显示服务端工具记录。CHAT调用。web_search_call.action.sources,不包含完整搜索来源面板或独立引用面板。兼容性与风险 / Compatibility and risks
/chat/completions配置继续使用原协议;新增配置字段有默认值,不要求迁移旧数据。/responses端点时才进入 Responses 请求路径,服务端搜索仍可通过开关关闭。web_search_call以隐藏 metadata 保存,仅用于 Responses 历史恢复和经过校验的只读展示;复制消息与非 Responses 请求会移除该 metadata。<tool>,不会绕过本地工具权限。web_search可能以SSRF_BLOCKED拒绝部分公开域名;该策略由模型服务端控制,Operit 仅保留并展示服务端结果。关联 Issue / Related issues
Closes #877
Fixes #989
Related: #948, #797, #946
验证 / Verification
已通过 / Passed
git diff --check upstream/development...HEADnpm --prefix web-chat run typechecknpm run build:webchatmise exec java@21.0.2 -- ./gradlew assembleDebug --stacktrace --no-daemon(BUILD SUCCESSFUL)openai:responses_web_search、action.queries解析和服务端工具详情弹窗。Vite 构建仅报告现有的 500 kB chunk 大小警告,构建成功。Android Debug APK 构建仅报告现有的资源值覆盖与 SDK XML 版本警告,构建成功。
已运行但被上游问题阻断 / Run but blocked upstream
mise exec java@21.0.2 -- ./gradlew :app:testDebugUnitTest --stacktrace --no-daemon已运行,但在:app:compileDebugUnitTestKotlin阶段失败,测试用例尚未开始执行。ThinkingQualityMappingTest.kt第 19、35、61 行:测试仍传入Int,当前实现已要求字符串选项 ID。相关实现与测试文件在本分支和upstream/development完全一致,且不在本 PR diff 中,因此判定为上游已有回归,本 PR 未混入无关修复。action_required,尚未启动任何 job;当前身份无上游仓库管理员权限,无法代为批准。证据 / Evidence
web_search,返回web_search_call和批量action.queries;同一轮也可继续调用 Operit 本地工具。检查清单 / Checklist
development。upstream/development的既有测试源码编译回归阻断。