From f8034f15ada8daf1bb0ed08ead330e3f7e67eee8 Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Tue, 3 Mar 2026 14:51:12 +0530 Subject: [PATCH 1/2] Remove defualt hardcoded thinking levels for gemini 3 family --- .../vertex_and_google_ai_studio_gemini.py | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py index dee826e578..0905f22362 100644 --- a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py +++ b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py @@ -1136,23 +1136,6 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig): if VertexGeminiConfig._is_gemini_3_or_newer(model): if "temperature" not in optional_params: optional_params["temperature"] = 1.0 - # Only add thinkingLevel if model supports it (exclude image models) - if "image" not in model.lower(): - thinking_config = optional_params.get("thinkingConfig", {}) - if ( - "thinkingLevel" not in thinking_config - and "thinkingBudget" not in thinking_config - ): - # For gemini-3-flash-preview, default to "minimal" to match Gemini 2.5 Flash behavior - # For other Gemini 3 models, default to "low" - is_gemini3flash = ( - "gemini-3-flash-preview" in model.lower() - or "gemini-3-flash" in model.lower() - ) - thinking_config["thinkingLevel"] = ( - "minimal" if is_gemini3flash else "low" - ) - optional_params["thinkingConfig"] = thinking_config return optional_params From 213423cb45308e47538b207dc043c1149e75cda7 Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Tue, 3 Mar 2026 15:05:20 +0530 Subject: [PATCH 2/2] Fix test case --- .../test_vertex_and_google_ai_studio_gemini.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py b/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py index 196bb00f40..8beb19bf1a 100644 --- a/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py +++ b/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py @@ -2130,7 +2130,7 @@ def test_reasoning_effort_dict_format_gemini_3(): assert result["thinkingConfig"]["thinkingLevel"] == "high" assert result["thinkingConfig"]["includeThoughts"] is True - # Test dict format without effort key - should fall back to Gemini 3 default (low) + # Test dict format without effort key - no thinkingConfig should be set optional_params = {} non_default_params = {"reasoning_effort": {"summary": "auto"}} result = v.map_openai_params( @@ -2139,8 +2139,8 @@ def test_reasoning_effort_dict_format_gemini_3(): model=model, drop_params=False, ) - # Gemini 3 defaults to thinkingLevel="low" when no explicit effort is set - assert result["thinkingConfig"]["thinkingLevel"] == "low" + # No effort key in dict → no thinkingConfig set + assert "thinkingConfig" not in result def test_temperature_default_for_gemini_3(): @@ -2453,8 +2453,8 @@ def test_gemini_3_image_models_no_thinking_config(): def test_gemini_3_text_models_get_thinking_config(): """ - Test that Gemini 3 text models DO receive automatic thinkingConfig. - This ensures we didn't break the existing behavior for non-image models. + Test that Gemini 3 text models do NOT receive automatic thinkingConfig + when no reasoning_effort or thinking param is provided. """ from litellm.llms.vertex_ai.gemini.vertex_and_google_ai_studio_gemini import ( VertexGeminiConfig, @@ -2462,7 +2462,7 @@ def test_gemini_3_text_models_get_thinking_config(): v = VertexGeminiConfig() - # Test gemini-3-pro-preview (text model, should get thinking) + # Test gemini-3-pro-preview (text model, no explicit thinking params) model = "gemini-3-pro-preview" optional_params = {} non_default_params = {} @@ -2474,9 +2474,8 @@ def test_gemini_3_text_models_get_thinking_config(): drop_params=False, ) - # Should have thinkingConfig automatically added - assert "thinkingConfig" in result - assert result["thinkingConfig"]["thinkingLevel"] == "low" + # Should NOT have thinkingConfig automatically added when user provides no reasoning_effort + assert "thinkingConfig" not in result assert result["temperature"] == 1.0