mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-07 06:29:41 +00:00
Merge pull request #22641 from BerriAI/litellm_remove_default_litellm_thinking
[Chore]Remove defualt hardcoded thinking levels for gemini 3 family
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user