Fix/gemini tool schema unsupported keys#52670
Merged
bennetbo merged 2 commits intozed-industries:mainfrom Mar 29, 2026
Merged
Conversation
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.
Summary
The Gemini API enforces strict validation on
function_declarationsand rejects requests containing unsupported JSON Schema keywords such asadditionalProperties,propertyNames. This caused Write mode to fail with "failed to stream completion" when tools with complex schemas were used.This PR strips these unsupported keywords from tool schemas before sending them to the Gemini API in
adapt_to_json_schema_subset.How to Review
crates/language_model/src/tool_schema.rs— theadapt_to_json_schema_subsetfunction now removesadditionalPropertiesandpropertyNamesfrom schemas.propertyNamesoradditionalPropertiesto the Gemini API — it returns HTTP 400INVALID_ARGUMENTHow to Test
Run the unit tests:
cargo test -p language_modelOR manually reproduce this using ->
Closes #52430
Video
Screencast.from.2026-03-29.08-32-18.webm
Note : Reopens previous work from closed PR #52644 (fork was deleted)
Release Notes: