fix: Google backend model mapping and Claude tool schema translations#391
Merged
su-kaka merged 4 commits intoJul 8, 2026
Merged
Conversation
…nd Claude - **Model mapping**: Added `map_antigravity_gemini_model` to accurately map client-requested models to Google's backend. Notably, `gemini-3.1-pro-high` is explicitly mapped to `gemini-pro-agent` since the original identifier was deprecated and returns an `INVALID_ARGUMENT` (400) error. - **Tool formatting fix**: Google's internal REST API strictly forbids passing both `parameters` and `parametersJsonSchema` inside `functionDeclarations`. Refactored `_ensure_empty_tool_schema_for_claude` to exclusively use the `parameters` field and drop `parametersJsonSchema` to resolve `INVALID_ARGUMENT` tool schema errors.
Contributor
Author
|
Now all the enpoints in antigravity works, claude and gemini 3.1 pro , gemini 3.5 flash |
…-antigravity-model-mappings-and-tools Conflicts resolved by unifying the tool schema normalization logic for both Gemini and Claude across different modes.
d7ee3bf to
60b138e
Compare
…rametersJsonSchema in geminicli mode
60b138e to
5a4f77d
Compare
2 tasks
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.
This PR fixes two critical issues occurring on Google's internal Antigravity backend (used in Vertex mode / antigravity endpoints) and GeminiCLI mode.
1. Model Mapping Fix (
INVALID_ARGUMENT)Google's backend deprecated the
gemini-3.1-pro-highmodel and replaced it withgemini-pro-agent.map_antigravity_gemini_modelto accurately map client-requested models to Google's backend.gemini-3.1-pro-hightogemini-pro-agentto resolve theINVALID_ARGUMENT(400) errors users were seeing.gemini-3.5-flash-highto-low. If a user explicitly requests the-highversion (which doesn't exist on the backend for 3.5 flash), they will now receive a native404 NOT_FOUNDerror instead of experiencing silent performance degradation.2. Tool Formatting Fix (
must not be set when parameters is set&Field required)Google's internal REST API translators have highly specific schema requirements depending on whether the underlying model is Gemini or Claude. The previous upstream logic incorrectly assumed Claude models needed
customblocks or behaved identically to Gemini.parametersJsonSchema. We now strip it and exclusively populate the standardparametersfield.geminicliandantigravity/Vertex AI channels) strictly requiresfunctionDeclarationsusing theparametersJsonSchemafield. Sendingparameterscauses the translator to miss the schema entirely, crashing withtools.0.custom.input_schema: Field required. Sendingcustomingeminiclimode crashes withUnknown name "custom"._ensure_empty_tool_schema_for_claudeto dynamically output the exact tool format expected by Google's backend translators based on the model family.