You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Gemini model was failing to respect 'required' parameter constraints in tool definitions, leading to invalid tool calls.
The root cause was that the proxy was sending a standard JSON Schema to the Gemini API, but the API expects a proprietary, non-standard format (uppercase types, no '$schema' or 'additionalProperties' keywords). This caused the API to return 400 errors or silently ignore the schema.
This commit refactors the tool schema conversion to use strongly-typed structs that represent the Gemini-specific format. A new conversion function recursively builds the schema, ensuring only supported fields are sent and types are correctly formatted.
This also corrects the JSON key for the parameters object from 'parametersJsonSchema' to 'parameters' to match the target API.
Additionally, this commit includes several robustness improvements discovered during debugging:
- Enable TCP KeepAlive on the upstream HTTP client to prevent idle timeouts.
- Add panic-safe checks when parsing the Gemini SSE stream.
- Add a keep-alive pinger to the client-facing SSE stream.
0 commit comments