litellm/tests
Cesar Garcia 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
..
agent_tests
audio_tests
basic_proxy_startup_tests
batches_tests chore: remove unused test files from repository root (#19150) 2026-01-16 02:34:41 +05:30
code_coverage_tests Revert "Litellm staging 01 15 2026" 2026-01-17 06:31:34 +09:00
documentation_tests
enterprise Merge remote-tracking branch 'origin' into litellm_user_promethus_metrics 2026-01-13 16:27:08 -08:00
guardrails_tests
image_gen_tests
litellm
litellm_utils_tests [Refactor] Add CI enforcement for O(1) operations in _get_model_cost_key to prevent performance regressions (#19052) 2026-01-13 17:08:03 -08:00
litellm-proxy-extras feat: Add Redis-based migration lock with bug fixes (#19261) 2026-01-19 05:57:24 -08:00
llm_responses_api_testing
llm_translation fix(agentcore): simplify agentcore streaming (#17141) 2026-01-19 05:20:24 -08:00
load_tests
local_testing feat(gemini): use responseJsonSchema for Gemini 2.0+ models (#19314) 2026-01-19 10:45:37 -08:00
logging_callback_tests Add user auth in standard logging object for bedrock passthrough 2026-01-15 18:36:06 +05:30
mcp_tests test: add mcp completions test 2026-01-15 15:47:45 +09:00
multi_instance_e2e_tests
ocr_tests
old_proxy_tests/tests
openai_endpoints_tests
otel_tests
pass_through_tests
pass_through_unit_tests [Feat] Claude Code x LiteLLM WebSearch - QA Fixes to work with Claude Code (#19294) 2026-01-17 16:30:31 -08:00
proxy_admin_ui_tests Revert "Revert "[Feature] Deleted Keys and Deleted Teams Table"" 2026-01-16 14:25:23 -08:00
proxy_security_tests
proxy_unit_tests fixing test 2026-01-16 19:06:23 -08:00
router_unit_tests
scim_tests
search_tests
spend_tracking_tests
store_model_in_db_tests
test_litellm feat(gemini): use responseJsonSchema for Gemini 2.0+ models (#19314) 2026-01-19 10:45:37 -08:00
unified_google_tests
vector_store_tests
windows_tests
__init__.py
gettysburg.wav
large_text.py
openai_batch_completions.jsonl
README.MD
test_budget_management.py
test_callbacks_on_proxy.py
test_config.py
test_debug_warning.py
test_end_users.py
test_entrypoint.py
test_fallbacks.py
test_gpt5_azure_temperature_support.py
test_health.py
test_keys.py
test_litellm_proxy_responses_config.py
test_logging.conf
test_models.py
test_openai_endpoints.py
test_organizations.py
test_passthrough_endpoints.py
test_ratelimit.py
test_resource_cleanup.py
test_service_logger_otel.py fix(langfuse_otel): ignore service logs and fix callback shadowing (#19298) 2026-01-19 05:53:47 -08:00
test_spend_logs.py
test_team_logging.py
test_team_members.py
test_team.py
test_users.py

In total litellm runs 1000+ tests

[02/20/2025] Update:

To make it easier to contribute and map what behavior is tested,

we've started mapping the litellm directory in tests/test_litellm

This folder can only run mock tests.