Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lm15/providers/gemini.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,14 @@
}

def gemini_level_class(model: str) -> bool:
"""True for the Gemini 3.x class: `thinkingLevel`, no full off (MAP-7 rule 10).
"""True for the Gemini 3.x/4.x class: `thinkingLevel`, no full off (MAP-7 rule 10).

Model-name table, receipted 2026-09-02: 2.5 models reject thinkingLevel,
3.x models take it; 3.7 Flash accepts thinkingBudget: 0 and still spends
thinking tokens. A table that rots; `extensions` overrides.
thinking tokens. 4.x (2026-11-20, Vertex): thinkingBudget is a 400.
A table that rots; `extensions` overrides.
"""
lowered = model.lower()
return lowered.startswith("models/gemini-3") or lowered.startswith("gemini-3")
return model.lower().removeprefix("models/").startswith(("gemini-3", "gemini-4"))



Expand Down
2 changes: 2 additions & 0 deletions tests/test_reasoning_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def test_model_class_tables() -> None:
assert anthropic_adaptive_class("claude-sonnet-5") and anthropic_adaptive_class("claude-opus-4-8") and anthropic_adaptive_class("claude-fable-5-1")
assert not anthropic_adaptive_class("claude-sonnet-4-5-20250929") and not anthropic_adaptive_class("claude-haiku-4-5-20251001")
assert gemini_level_class("gemini-3.7-flash") and gemini_level_class("models/gemini-3.1-pro-preview")
assert gemini_level_class("gemini-4-neon") and gemini_level_class("models/gemini-4-carbon")
assert not gemini_level_class("gemini-2.5-flash")
assert EFFORT_THINKING_BUDGETS == {"minimal": 1024, "low": 2048, "medium": 8192, "high": 16384, "xhigh": 24576, "max": 32768}

Expand Down Expand Up @@ -148,6 +149,7 @@ def test_gemini_two_classes() -> None:
assert tc("gemini-2.5-flash", Reasoning(effort="off")) == {"thinkingBudget": 0}
assert tc("gemini-3.7-flash", Reasoning(effort="medium", summary="auto")) == {"includeThoughts": True, "thinkingLevel": "medium"}
assert tc("gemini-3.7-flash", Reasoning(effort="medium", thinking_budget=512)) == {"thinkingBudget": 512}
assert tc("gemini-4-neon", Reasoning(effort="medium")) == {"thinkingLevel": "medium"}
# MAP-13: above the ceiling clamps to "high"; off on the 3 class (no honoured
# off switch) substitutes the lowest level — both recorded.
for eff in ("xhigh", "max"):
Expand Down
Loading