Cesar Garcia and GitHub
d30c25af21
feat(gemini): use responseJsonSchema for Gemini 2.0+ models ( #19314 )
...
* feat(gemini): add opt-in support for responseJsonSchema
Add support for Gemini's native responseJsonSchema parameter which uses
standard JSON Schema format instead of OpenAPI-style responseSchema.
Benefits of responseJsonSchema (Gemini 2.0+ only):
- Standard JSON Schema format (lowercase types)
- Supports additionalProperties for stricter validation
- Better compatibility with Pydantic's model_json_schema()
- No propertyOrdering required
Usage:
```python
response_format={
"type": "json_schema",
"json_schema": {"schema": {...}},
"use_json_schema": True # opt-in
}
```
This is backwards compatible - existing code continues to use
responseSchema by default.
Closes #16340
* docs: add documentation for use_json_schema parameter
Document the new use_json_schema option for Gemini 2.0+ models
in the JSON Mode documentation.
* refactor(gemini): use responseJsonSchema by default for Gemini 2.0+
Remove opt-in flag `use_json_schema` and automatically detect model version:
- Gemini 2.0+: uses responseJsonSchema (standard JSON Schema, supports additionalProperties)
- Gemini 1.5: uses responseSchema (OpenAPI format, legacy)
This follows LiteLLM's philosophy of abstracting provider differences -
users write the same code regardless of model version.
* test(vertex): update json_schema tests to accept both responseSchema formats
Gemini 2.x+ uses responseJsonSchema while Gemini 1.x uses responseSchema.
Update tests to accept both formats since litellm now auto-selects based
on model version.
2026-01-19 10:45:37 -08:00
..
2024-09-28 21:08:14 -07:00
2025-07-24 18:32:56 -07:00
2025-10-25 10:19:24 -07:00
2025-10-25 10:19:24 -07:00
2024-11-07 04:17:05 +05:30
2025-01-05 14:00:17 -08:00
2024-09-28 21:08:14 -07:00
2025-10-20 16:52:23 -07:00
2024-09-28 21:08:14 -07:00
2025-09-25 15:47:01 -07:00
2025-08-23 13:13:23 -07:00
2024-12-23 17:42:24 -08:00
2024-09-28 21:08:14 -07:00
2024-09-28 21:08:14 -07:00
2025-04-09 14:01:48 -07:00
2024-09-28 21:08:14 -07:00
2024-09-28 21:08:14 -07:00
2024-09-28 21:08:14 -07:00
2024-09-28 21:08:14 -07:00
2024-09-28 21:08:14 -07:00
2024-09-28 21:08:14 -07:00
2024-09-28 21:08:14 -07:00
2025-01-13 19:34:34 -08:00
2025-02-02 22:36:37 -08:00
2025-10-25 10:19:24 -07:00
2024-11-07 04:17:05 +05:30
2025-09-25 15:47:01 -07:00
2025-12-04 13:29:20 -08:00
2025-12-22 17:03:53 -08:00
2026-01-19 10:45:37 -08:00
2026-01-02 11:08:35 +05:30
2026-01-07 14:20:10 +09:00
2025-11-22 09:28:37 -08:00
2025-10-25 11:11:36 -07:00
2025-10-25 11:47:03 -07:00
2025-12-17 11:10:14 +05:30
2024-10-14 16:34:01 +05:30
2025-10-25 12:26:06 -07:00
2025-10-25 10:19:24 -07:00
2025-11-22 11:20:40 -08:00
2024-09-28 21:08:14 -07:00
2025-08-06 08:43:45 -07:00
2024-11-18 19:44:06 -08:00
2025-08-20 21:46:33 -07:00
2024-10-01 19:44:20 -04:00
2026-01-14 13:33:07 +05:30
2025-10-25 10:19:24 -07:00
2025-12-06 09:41:09 -08:00
2025-10-25 10:19:24 -07:00
2025-12-22 17:03:53 -08:00
2026-01-14 14:55:17 +05:30
2026-01-07 15:09:44 +05:30
2025-10-25 10:19:24 -07:00
2024-12-24 16:49:02 -08:00
2024-09-28 21:08:14 -07:00
2025-10-31 18:20:52 -07:00
2025-12-15 14:16:36 -08:00
2025-11-07 15:02:41 -08:00
2024-11-12 22:50:51 +05:30
2025-09-25 15:47:01 -07:00
2025-09-25 15:47:01 -07:00
2024-09-28 21:08:14 -07:00
2026-01-13 10:34:01 +09:00
2025-12-22 17:03:53 -08:00
2024-09-28 21:08:14 -07:00
2024-09-28 21:08:14 -07:00
2025-11-22 09:41:15 -08:00
2025-12-23 14:56:42 +05:30
2025-12-22 17:03:53 -08:00
2025-08-04 16:09:33 -07:00
2026-01-02 12:31:31 +05:30
2025-12-04 21:49:33 +05:30
2024-10-05 18:59:11 -04:00
2025-12-18 17:25:43 -03:00
2025-09-18 23:37:38 -07:00
2024-09-28 21:08:14 -07:00
2024-09-28 21:08:14 -07:00
2024-10-16 07:32:06 -07:00
2025-10-25 10:19:24 -07:00
2025-07-10 18:20:41 -07:00
2024-12-12 14:32:39 -08:00
2025-03-13 21:35:39 -07:00
2024-09-28 21:08:14 -07:00
2025-09-25 15:47:01 -07:00
2025-10-25 15:10:45 -07:00
2024-09-28 21:08:14 -07:00
2024-10-03 18:02:28 -04:00
2025-05-13 09:42:22 -07:00
2025-10-25 10:19:24 -07:00
2025-10-25 10:19:24 -07:00
2024-09-28 21:08:14 -07:00
2024-11-07 04:17:05 +05:30
2024-09-28 21:08:14 -07:00
2025-10-25 10:19:24 -07:00
2025-10-25 10:19:24 -07:00
2024-09-28 21:08:14 -07:00
2024-10-14 16:34:01 +05:30
2024-11-02 00:44:32 +05:30
2025-10-25 10:19:24 -07:00
2025-09-27 13:57:43 -07:00
2025-09-01 17:59:40 -07:00
2024-09-28 21:08:14 -07:00
2024-09-28 21:08:14 -07:00
2024-09-28 21:08:14 -07:00
2024-09-28 21:08:14 -07:00
2025-12-18 08:49:23 -08:00
2026-01-12 17:27:13 +05:30
2025-11-05 16:29:50 -08:00
2025-12-20 20:48:11 +05:30
2024-09-28 21:08:14 -07:00
2025-09-27 11:38:08 -07:00
2025-10-31 18:20:52 -07:00
2025-10-25 10:19:24 -07:00
2024-11-07 04:17:05 +05:30
2025-10-25 10:19:24 -07:00
2024-09-28 21:08:14 -07:00
2024-09-28 21:08:14 -07:00
2025-10-18 11:12:00 -07:00
2025-12-22 12:41:30 +05:30
2025-10-28 19:05:13 -07:00
2025-09-01 17:04:47 -07:00
2025-10-31 18:20:52 -07:00
2025-10-25 10:19:24 -07:00
2025-10-25 16:46:29 -07:00
2025-10-25 10:19:24 -07:00
2024-09-28 21:08:14 -07:00
2025-10-25 10:19:24 -07:00
2025-02-15 14:54:23 -08:00
2026-01-17 16:34:46 -08:00
2026-01-16 16:37:44 +05:30
2025-10-25 10:19:24 -07:00
2024-11-05 22:03:44 +05:30
2026-01-13 11:44:48 +05:30
2026-01-19 05:18:35 -08:00
2025-10-25 10:19:24 -07:00
2025-11-22 10:46:12 -08:00
2024-09-28 21:08:14 -07:00
2025-10-28 19:05:13 -07:00
2024-10-01 19:44:20 -04:00
2025-03-21 16:21:18 -07:00
2024-09-28 21:08:14 -07:00
2025-05-13 09:42:22 -07:00
2024-09-28 21:08:14 -07:00
2025-09-01 17:04:47 -07:00
2025-08-07 15:22:52 -07:00
2026-01-07 15:02:10 +05:30
2024-10-01 19:44:20 -04:00
2024-09-28 21:08:14 -07:00
2025-08-14 16:24:14 -07:00
2025-10-25 10:19:24 -07:00
2024-09-28 21:08:14 -07:00
2025-10-25 10:19:24 -07:00
2025-02-10 22:13:58 -08:00
2024-10-17 22:09:11 -07:00
2025-09-25 15:47:01 -07:00
2025-04-01 07:12:29 -07:00
2024-09-28 21:08:14 -07:00
2024-11-07 04:17:05 +05:30
2024-09-28 21:08:14 -07:00
2024-09-28 21:08:14 -07:00
2024-12-04 19:40:28 -08:00
2025-01-05 13:43:32 -08:00
2025-05-01 14:56:54 -07:00