From 9b92ea16ab6e94eeb3cab19e5f17008c703ecc0a Mon Sep 17 00:00:00 2001 From: Julio Quinteros Pro Date: Tue, 3 Mar 2026 19:55:18 -0300 Subject: [PATCH] fix: update response_format test for vertex_ai's intentional schema diff Vertex AI / Gemini uses Pydantic's model_json_schema() which omits additionalProperties: False (Gemini rejects it). The test expected the same schema for all providers. Co-Authored-By: Claude Opus 4.6 --- tests/test_litellm/test_utils.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/tests/test_litellm/test_utils.py b/tests/test_litellm/test_utils.py index 7f0b3b5b50..55e635f3e1 100644 --- a/tests/test_litellm/test_utils.py +++ b/tests/test_litellm/test_utils.py @@ -1139,20 +1139,25 @@ def test_pre_process_non_default_params(model, custom_llm_provider): provider_config=provider_config, ) print(processed_non_default_params) + # Vertex AI / Gemini uses Pydantic's model_json_schema() which doesn't + # include additionalProperties: False (Gemini rejects it). Other + # providers use OpenAI's to_strict_json_schema() which does. + expected_schema = { + "properties": { + "x": {"title": "X", "type": "string"}, + "y": {"title": "Y", "type": "string"}, + }, + "required": ["x", "y"], + "title": "ResponseFormat", + "type": "object", + } + if custom_llm_provider not in ("vertex_ai", "vertex_ai_beta", "gemini"): + expected_schema["additionalProperties"] = False assert processed_non_default_params == { "response_format": { "type": "json_schema", "json_schema": { - "schema": { - "properties": { - "x": {"title": "X", "type": "string"}, - "y": {"title": "Y", "type": "string"}, - }, - "required": ["x", "y"], - "title": "ResponseFormat", - "type": "object", - "additionalProperties": False, - }, + "schema": expected_schema, "name": "ResponseFormat", "strict": True, },