Skip to content

fix(anthropic): preserve DeepSeek native web search tools - #2423

Merged
looplj merged 1 commit into
looplj:unstablefrom
remote-controlled-man:fix/deepseek-native-web-search-2226
Sep 7, 2026
Merged

looplj merged 1 commit into
looplj:unstablefrom
remote-controlled-man:fix/deepseek-native-web-search-2226

Conversation

@remote-controlled-man

@remote-controlled-man remote-controlled-man commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #2226

DeepSeek's Anthropic-compatible Messages API supports the native web_search_20250305 server tool, but AxonHub currently marks both deepseek_anthropic and PlatformDeepSeek as not supporting Anthropic native tools. In mixed candidate sets this filters out the DeepSeek channel, and outbound conversion also removes the tool definition.

This change aligns both existing capability checks so DeepSeek Anthropic channels remain eligible and the native web-search definition is preserved in the outbound request. Other Anthropic-compatible channels remain unchanged.

DeepSeek's official deepseek-harness sends this exact tool type to its Anthropic-compatible Messages endpoint:
https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/web/web-search-deepseek/src/provider.ts

Verification:

  • Added regression coverage for mixed candidate routing.
  • Covered native web search alone and beside a normal function tool.
  • Verified the outbound web_search_20250305 type and max_uses value.
  • go test ./transformer/anthropic -count=1
  • go test ./internal/ent/channel -count=1
  • go test ./internal/server/orchestrator -count=1

🤖 Assisted by OpenAI Codex.

Summary by CodeRabbit

  • New Features

    • DeepSeek’s Anthropic-compatible endpoint now supports Anthropic native tools, including web search.
    • Web search settings such as maximum usage limits are preserved for DeepSeek requests.
  • Tests

    • Added coverage confirming native tools are retained for supported DeepSeek channels and filtered from unsupported channels.

Copilot AI lite review requested due to automatic review settings September 6, 2026 17:51
@coderabbitai

coderabbitai Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: d891b14f-8a2d-4492-bc8e-9417049abb05

📥 Commits

Reviewing files that changed from the base of the PR and between 04654c2 and 1df891e.

📒 Files selected for processing (8)
  • internal/ent/channel/type.go
  • internal/ent/channel/type_test.go
  • internal/server/orchestrator/candidates_anthropic.go
  • internal/server/orchestrator/candidates_anthropic_test.go
  • llm/transformer/anthropic/outbound_convert.go
  • llm/transformer/anthropic/outbound_test.go
  • llm/transformer/anthropic/tools.go
  • llm/transformer/anthropic/tools_test.go

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

DeepSeek Anthropic channels now support Anthropic native tools. Candidate selection preserves DeepSeek channels, and outbound conversion preserves web-search tools with their configured usage limits. Tests cover channel classification, selection, and conversion.

Changes

DeepSeek native tool support

Layer / File(s) Summary
Native tool support predicates
internal/ent/channel/type.go, internal/ent/channel/type_test.go, llm/transformer/anthropic/tools.go, llm/transformer/anthropic/tools_test.go
DeepSeek channel and platform types now report Anthropic native tool support.
Candidate selection filtering
internal/server/orchestrator/candidates_anthropic.go, internal/server/orchestrator/candidates_anthropic_test.go
Anthropic candidate selection preserves direct Anthropic and DeepSeek-Anthropic candidates while excluding Moonshot-Anthropic candidates.
Outbound native tool preservation
llm/transformer/anthropic/outbound_convert.go, llm/transformer/anthropic/outbound_test.go
DeepSeek web-search tools are converted to Anthropic native tools, and configured MaxUses values are validated.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 1df89

DeepSeek Anthropic requests now retain native web-search tools and their configured usage limits while unsupported channels remain excluded. The change is covered across routing and outbound conversion and is ready to merge.

Suggested reviewers: looplj

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 8 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: preserving DeepSeek native web search tools.
Linked Issues check ✅ Passed The changes satisfy issue [#2226]. They enable native Anthropic tool support for DeepSeek at the channel and transformer levels, keep DeepSeek candidates eligible, and add regression coverage for pres…
Out of Scope Changes check ✅ Passed All changes are related to the linked issue. Capability updates, candidate-selection coverage, transformer tests, and supporting comment corrections are within scope.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The newly added orchestrator test helper returns a named slice type without conversion (won’t compile), and there remains a capability mismatch risk around anthropic_gcp being marked as supporting native tools while the outbound transformer still treats PlatformVertex as unsupported.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR updates Anthropic-native tool capability detection so DeepSeek’s Anthropic-compatible channel remains eligible when requests include the native web_search_20250305 tool, and adds regression tests to ensure web_search survives outbound conversion for DeepSeek.

Changes:

  • Mark DeepSeek’s Anthropic transformer platform as supporting Anthropic native tools (so web_search is no longer filtered out).
  • Mark deepseek_anthropic channel type as supporting Anthropic native tools (so candidate selection keeps it in mixed candidate sets).
  • Extend outbound transformer tests to assert web_search_20250305 conversion details (including max_uses) for DeepSeek, plus add orchestrator selector regression coverage.
File summaries
File Description
llm/transformer/anthropic/tools.go Treat PlatformDeepSeek as supporting Anthropic native tools.
llm/transformer/anthropic/tools_test.go Add PlatformDeepSeek coverage for native-tool support detection.
llm/transformer/anthropic/outbound_test.go Update filtering expectations so DeepSeek preserves native tools; assert web_search_20250305 + max_uses.
llm/transformer/anthropic/outbound_convert.go Clarify conversion comment about filtering based on native-tool support.
internal/server/orchestrator/candidates_anthropic.go Update selector docs/examples to reflect DeepSeek support.
internal/server/orchestrator/candidates_anthropic_test.go New regression test ensuring DeepSeek remains in compatible candidate set.
internal/ent/channel/type.go Include TypeDeepseekAnthropic in SupportsAnthropicNativeTools().
internal/ent/channel/type_test.go Update expectation: deepseek_anthropic supports Anthropic native tools.
Review details
  • Files reviewed: 8/8 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +17 to +19
func (s staticAnthropicCandidateSelector) Select(context.Context, *llm.Request) ([]*ChannelModelsCandidate, error) {
return s, nil
}
Comment on lines +42 to +43
return t == TypeAnthropic || t == TypeAnthropicAWS || t == TypeAnthropicGcp ||
t == TypeClaudecode || t == TypeDeepseekAnthropic
@looplj
looplj merged commit 9f31056 into looplj:unstable Sep 7, 2026
6 checks passed
Edint386 pushed a commit to Edint386/axonhub that referenced this pull request Sep 7, 2026
@remote-controlled-man
remote-controlled-man deleted the fix/deepseek-native-web-search-2226 branch October 13, 2026 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug/错误]: 选择Deepseek提供商并关闭透传时,错误剥离了服务端搜索工具web_search_20250305

3 participants