From 3646aa945e2e727d64908e0def11e246d2e2365f Mon Sep 17 00:00:00 2001 From: Charlie Patterson Date: Wed, 17 Jun 2026 15:55:32 -0700 Subject: [PATCH 1/2] fix: ensure checks show gemini-3-flash-preview supports responseJsonSchema. --- litellm/llms/vertex_ai/common_utils.py | 2 +- .../vertex_ai/test_vertex_ai_common_utils.py | 24 +++++++++++++++---- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/litellm/llms/vertex_ai/common_utils.py b/litellm/llms/vertex_ai/common_utils.py index 85c23d8603c..5028c0cf5c8 100644 --- a/litellm/llms/vertex_ai/common_utils.py +++ b/litellm/llms/vertex_ai/common_utils.py @@ -271,7 +271,7 @@ def supports_response_json_schema(model: str) -> bool: # Gemini 2.0+ and 2.5+ models support responseJsonSchema # Pattern matches: gemini-2.0-*, gemini-2.5-*, gemini-3-*, etc. - gemini_2_plus_pattern = re.compile(r"gemini-([2-9]|[1-9]\d+)\.") + gemini_2_plus_pattern = re.compile(r"gemini-(?:[2-9]|[1-9]\d+)(?:\.|\-)") return bool(gemini_2_plus_pattern.search(model_lower)) diff --git a/tests/test_litellm/llms/vertex_ai/test_vertex_ai_common_utils.py b/tests/test_litellm/llms/vertex_ai/test_vertex_ai_common_utils.py index 4768fa439d5..6c4a6f70bc2 100644 --- a/tests/test_litellm/llms/vertex_ai/test_vertex_ai_common_utils.py +++ b/tests/test_litellm/llms/vertex_ai/test_vertex_ai_common_utils.py @@ -17,6 +17,7 @@ get_vertex_project_id_from_url, pop_vertex_request_labels, set_schema_property_ordering, + supports_response_json_schema, vertex_request_labels_from_litellm_params, ) @@ -150,6 +151,23 @@ async def test_get_supports_system_message(): assert result == False +@pytest.mark.parametrize( + "model, expected", + [ + ("gemini-2.0-flash", True), + ("gemini-1.5-pro", False), + ("random-model-name", False), + ("gemini-3-flash-preview", True), + ("gemini-123-pro", True), + ("vertex_ai/gemini-3.1-pro-preview", True), + ], +) +async def test_supports_response_json_schema(model: str, expected: bool): + """Test supports_response_json_schema correctly detects Gemini 2.0+ model names""" + + assert supports_response_json_schema(model) == expected + + def test_set_schema_property_ordering_with_excessive_nesting(): """Test set_schema_property_ordering with excessive nesting > max levels +1 deep.""" # generate a schema with excessive nesting @@ -1526,11 +1544,7 @@ def test_vertex_request_labels_from_litellm_params_extracts_requester_metadata() def test_vertex_request_labels_from_litellm_params_accepts_litellm_metadata(): - lp = { - "litellm_metadata": { - "requester_metadata": {"team": "platform", "count": 3} - } - } + lp = {"litellm_metadata": {"requester_metadata": {"team": "platform", "count": 3}}} assert vertex_request_labels_from_litellm_params(lp) == {"team": "platform"} From 2a2e5026d55edf00e54920400a72fa27b48ad131 Mon Sep 17 00:00:00 2001 From: Charlie Patterson Date: Wed, 17 Jun 2026 17:18:24 -0700 Subject: [PATCH 2/2] fix: remove async keyword from test. --- .../test_litellm/llms/vertex_ai/test_vertex_ai_common_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_litellm/llms/vertex_ai/test_vertex_ai_common_utils.py b/tests/test_litellm/llms/vertex_ai/test_vertex_ai_common_utils.py index 6c4a6f70bc2..bebf856ee6e 100644 --- a/tests/test_litellm/llms/vertex_ai/test_vertex_ai_common_utils.py +++ b/tests/test_litellm/llms/vertex_ai/test_vertex_ai_common_utils.py @@ -162,7 +162,7 @@ async def test_get_supports_system_message(): ("vertex_ai/gemini-3.1-pro-preview", True), ], ) -async def test_supports_response_json_schema(model: str, expected: bool): +def test_supports_response_json_schema(model: str, expected: bool): """Test supports_response_json_schema correctly detects Gemini 2.0+ model names""" assert supports_response_json_schema(model) == expected