Skip to content

Conversation

evan-onyx
Copy link
Contributor

@evan-onyx evan-onyx commented May 19, 2025

Description

https://linear.app/danswer/issue/DAN-1990/fix-anthropic-tool-calling
Revert behavior from anthropic models to not use their tool calling support. Anthropic models generate text before and after tool calls, and also throw an error if they are provided tool call messages from an earlier conversation without corresponding tools. Because we don't support sequential tool calling and it makes our UI ugly, we treat anthropic as non-tool-calling.

How Has This Been Tested?

tested in UI and added a unit test

Backporting (check the box to trigger backport action)

Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.

  • This PR should be backported (make sure to check that the backport attempt succeeds)
  • [Optional] Override Linear Check

@evan-onyx evan-onyx marked this pull request as ready for review May 19, 2025 18:07
Copy link

vercel bot commented May 19, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
internal-search ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 19, 2025 6:17pm

@evan-onyx evan-onyx requested a review from a team as a code owner May 19, 2025 18:07
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Modified explicit_tool_calling_supported to disable tool calling for Anthropic models due to UI limitations and sequential tool calling constraints.

  • Added comprehensive test coverage in backend/tests/unit/onyx/tools/test_utils.py with parameterized scenarios for Anthropic and non-Anthropic models
  • Modified backend/onyx/tools/utils.py to check against both provider name and litellm.anthropic_models list
  • Added clear documentation explaining why Anthropic models need to be treated as non-tool-calling (UI limitations and error patterns)
  • Implemented fail-safe checks to prevent tool calling when model is in litellm.anthropic_models list, even if provider name differs

2 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

@evan-onyx evan-onyx added this pull request to the merge queue May 19, 2025
Merged via the queue into main with commit b76e475 May 19, 2025
11 of 12 checks passed
@evan-onyx evan-onyx deleted the bugfix/fix-anthropic-tool-calling branch May 19, 2025 21:31
ferdinandl007 pushed a commit to ferdinandl007/onyx that referenced this pull request May 27, 2025
* anthropic fix

* naming
aronszanto pushed a commit to aronszanto/onyx that referenced this pull request May 27, 2025
* anthropic fix

* naming
ZhipengHe pushed a commit to ZhipengHe/onyx that referenced this pull request Jun 6, 2025
* anthropic fix

* naming
AnkitTukatek pushed a commit to TukaTek/onyx that referenced this pull request Sep 23, 2025
* anthropic fix

* naming
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.

2 participants