TensorZero fails to convert nullable JSON Schema types for Gemini Vertex AI #6920
Replies: 3 comments
-
|
Hi @chaizhenhua thanks for the bug report. I'll close and convert to an issue so that we get this fixed shortly. |
Beta Was this translation helpful? Give feedback.
-
|
Hi @chaizhenhua - I'm not convinced that automatically making nullable fields mandatory is the right solution. If people don't realize this is happening, it could lead to incorrect behavior downstream of TensorZero. I think we should continue to error, and the user can decide if they want to update their schema or choose a different model. |
Beta Was this translation helpful? Give feedback.
-
|
Hi @GabrielBianconi, I suggest TensorZero itself handle nullable types and other schema differences (e.g., array types like ["string","null"]), similar to the reference implementation in this PR: feat(gemini): simplify JSON Schemas for API compatibility (rust‑genai #162) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description:
When using TensorZero Gateway to proxy LLM requests to GCP Vertex AI Gemini (gcp_vertex_gemini provider), tool/function declarations that contain nullable parameter types cause a 400 Bad Request error
from the Gemini API.
Root Cause:
Some tool parameters use the JSON Schema convention "type": ["string", "null"] to express nullable types (common in OpenAI-compatible schemas). TensorZero passes these array-typed type fields directly
to the Gemini Vertex AI API without conversion. Gemini's protobuf-based API expects type to be a single string enum value (e.g. "STRING"), not an array.
Error:
Invalid JSON payload received. Unknown name "type" at
'tools[0].function_declarations[4].parameters.properties[0].value':
Proto field is not repeating, cannot start list.
Expected Behavior:
TensorZero should normalize nullable type declarations before sending to Gemini. For example:
Steps to Reproduce:
Environment:
Workaround:
Bypass TensorZero and call Gemini directly using a client library (e.g. genai crate with Gemini adapter) that properly converts tool schemas to Gemini's expected format.
Beta Was this translation helpful? Give feedback.
All reactions