fix: carry Anthropic tool input schemas as-is - #2472
Open
CodePrometheus wants to merge 1 commit into
Open
Conversation
Signed-off-by: Zixin Zhou <zhouzixin@apache.org>
📄 Knowledge reviewDosu skipped reviewing this PR because your organization has used its |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2472 +/- ##
=======================================
Coverage 85.05% 85.05%
=======================================
Files 159 159
Lines 22649 22649
=======================================
Hits 19265 19265
Misses 2217 2217
Partials 1167 1167 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
An Anthropic tool declares its input as a JSON schema, but the gateway modeled that schema as a struct with only "type", "properties" and "required".
Everything else a client sends is silently dropped on the way to the backend: "additionalProperties", which backends need to enable strict schema adherence, the per-property "description" the model relies on to call the tool correctly, "$defs", and so on.
We hit this with a tool that takes no arguments: its empty "properties" was dropped too, and the OpenAI-compatible backend rejected the whole request with 400 invalid_function_parameters, "object schema missing properties".
The schema is now carried as raw JSON, so tools reach the backend as the client declared them. This covers both the Anthropic-to-OpenAI and the Anthropic-to-Bedrock conversions, which shared the struct.
Related Issues/PRs (if applicable)
Special notes for reviewers (if applicable)