Skip to main content

Google Gemini

Gemini supports structured output via response_schema. Use GEMINI_DOCUMENT_SCHEMA which omits additionalProperties (unsupported by Gemini).
GEMINI_DOCUMENT_SCHEMA is specifically designed for Gemini — it removes additionalProperties fields that Gemini doesn’t support and uses explicit metadata property definitions.

Why a separate schema?

Gemini’s structured output has different constraints than OpenAI:
FeatureOpenAIGemini
additionalPropertiesRequired for strict modeNot supported
Nullable types"type": ["string", "null"]Not needed
All fields requiredYes (strict mode)No
The GEMINI_DOCUMENT_SCHEMA handles these differences so you don’t have to.