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:
| Feature | OpenAI | Gemini |
|---|
additionalProperties | Required for strict mode | Not supported |
| Nullable types | "type": ["string", "null"] | Not needed |
| All fields required | Yes (strict mode) | No |
The GEMINI_DOCUMENT_SCHEMA handles these differences so you don’t have to.