Skip to content

Strip additionalProperties from Gemini function declaration schemas#5

Merged
Tom-Ryder merged 2 commits intoTom-Ryder:mainfrom
subpop:gemini-tool-call-parameters
Mar 26, 2026
Merged

Strip additionalProperties from Gemini function declaration schemas#5
Tom-Ryder merged 2 commits intoTom-Ryder:mainfrom
subpop:gemini-tool-call-parameters

Conversation

@subpop
Copy link
Contributor

@subpop subpop commented Mar 26, 2026

The Gemini API rejects the additionalProperties field in function
declaration schemas with HTTP 400. Add a GeminiSchema wrapper that
re-encodes JSONSchema identically but omits additionalProperties,
recursively handling nested objects, arrays, and anyOf variants.

I also found an issue with the Vertex endpoint:

The Vertex AI rawPredict endpoint specifies the model in the URL path
and rejects it in the request body with 'Extra inputs are not permitted'.
Re-encode the inner AnthropicRequest with model set to nil so
encodeIfPresent skips it.

subpop added 2 commits March 26, 2026 12:47
The Gemini API rejects the additionalProperties field in function
declaration schemas with HTTP 400. Add a GeminiSchema wrapper that
re-encodes JSONSchema identically but omits additionalProperties,
recursively handling nested objects, arrays, and anyOf variants.
The Vertex AI rawPredict endpoint specifies the model in the URL path
and rejects it in the request body with 'Extra inputs are not permitted'.
Re-encode the inner AnthropicRequest with model set to nil so
encodeIfPresent skips it.
@Tom-Ryder
Copy link
Owner

Nice find on the additionalProperties rejection. Merging.

@Tom-Ryder Tom-Ryder merged commit 5f8e42a into Tom-Ryder:main Mar 26, 2026
3 checks passed
@subpop subpop deleted the gemini-tool-call-parameters branch March 27, 2026 01:31
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