mirror of
https://github.com/TauricResearch/TradingAgents.git
synced 2026-06-29 19:26:24 +03:00
chore(models): retire deprecated models, simplify thinking config
Trim each provider to current-generation models and drop the special-casing they required: - OpenAI: remove gpt-4.1 (deprecated; the only non-reasoning model). - Anthropic: remove Claude Sonnet 4.5 (legacy; the only Sonnet that 400s on effort). - Google: remove the Gemini 2.5 line (superseded by 3.x). - Gemini client: drop the integer thinking_budget mapping; 3.x takes the string thinking_level directly. Effort/reasoning gates stay as defense in depth for custom model IDs. All kept IDs verified against live APIs.
This commit is contained in:
@@ -21,7 +21,7 @@ class TestGoogleApiKeyStandardization(unittest.TestCase):
|
||||
for msg, kwargs, expected_key in test_cases:
|
||||
with self.subTest(msg=msg):
|
||||
mock_chat.reset_mock()
|
||||
client = GoogleClient("gemini-2.5-flash", **kwargs)
|
||||
client = GoogleClient("gemini-3.5-flash", **kwargs)
|
||||
client.get_llm()
|
||||
call_kwargs = mock_chat.call_args[1]
|
||||
self.assertEqual(call_kwargs.get("google_api_key"), expected_key)
|
||||
|
||||
46
tests/test_google_thinking_level.py
Normal file
46
tests/test_google_thinking_level.py
Normal file
@@ -0,0 +1,46 @@
|
||||
"""Gemini thinking_level forwarding (Gemini 3.x).
|
||||
|
||||
The catalog is Gemini 3.x only, which takes the string ``thinking_level``
|
||||
directly. Pro accepts low/high; Flash also accepts minimal/medium — an
|
||||
unsupported "minimal" on Pro is mapped to "low".
|
||||
"""
|
||||
|
||||
from unittest import mock
|
||||
|
||||
import pytest
|
||||
|
||||
from tradingagents.llm_clients.google_client import GoogleClient
|
||||
|
||||
|
||||
def _captured_kwargs(model, **kwargs):
|
||||
captured = {}
|
||||
with mock.patch.object(
|
||||
__import__("tradingagents.llm_clients.google_client", fromlist=["x"]),
|
||||
"NormalizedChatGoogleGenerativeAI",
|
||||
lambda **kw: captured.setdefault("kw", kw),
|
||||
):
|
||||
GoogleClient(model, api_key="x", **kwargs).get_llm()
|
||||
return captured["kw"]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("level", ["minimal", "low", "medium", "high"])
|
||||
def test_flash_passes_thinking_level_through(level):
|
||||
kw = _captured_kwargs("gemini-3.5-flash", thinking_level=level)
|
||||
assert kw["thinking_level"] == level
|
||||
assert "thinking_budget" not in kw # the 2.5-era param is gone
|
||||
|
||||
|
||||
def test_pro_remaps_minimal_to_low():
|
||||
kw = _captured_kwargs("gemini-3.1-pro-preview", thinking_level="minimal")
|
||||
assert kw["thinking_level"] == "low" # Pro doesn't accept "minimal"
|
||||
|
||||
|
||||
def test_pro_keeps_high():
|
||||
kw = _captured_kwargs("gemini-3.1-pro-preview", thinking_level="high")
|
||||
assert kw["thinking_level"] == "high"
|
||||
|
||||
|
||||
def test_no_thinking_level_is_omitted():
|
||||
kw = _captured_kwargs("gemini-3.5-flash")
|
||||
assert "thinking_level" not in kw
|
||||
assert "thinking_budget" not in kw
|
||||
Reference in New Issue
Block a user