mirror of
https://github.com/TauricResearch/TradingAgents.git
synced 2026-06-16 21:06:15 +03:00
fix(llm): gate MiniMax reasoning_split by model capability (#826)
MinimaxChatOpenAI unconditionally set reasoning_split=True, but the kwarg is only valid on M2.x reasoning models. The openai SDK's strict kwarg validation raised TypeError for Coding Plan and any other non- reasoning MiniMax model. Adds requires_reasoning_split to ModelCapabilities, gates the payload injection on it, and only sets True for _MINIMAX_THINKING (M2.x exact IDs and the ^MiniMax-M\d forward-compat pattern). Same shape as the existing supports_tool_choice gate. Regression tests cover both halves: M2.x models still receive the flag, non-reasoning MiniMax models do not.
This commit is contained in:
@@ -75,6 +75,22 @@ class TestMinimaxExactMatches:
|
||||
def test_m2_base_rejects_tool_choice(self):
|
||||
assert get_capabilities("MiniMax-M2").supports_tool_choice is False
|
||||
|
||||
def test_m2_x_requires_reasoning_split(self):
|
||||
# M2.x reasoning models need reasoning_split=True so <think> blocks
|
||||
# land in reasoning_details instead of content (#826).
|
||||
for model in ("MiniMax-M2.7", "MiniMax-M2.5-highspeed", "MiniMax-M2"):
|
||||
assert get_capabilities(model).requires_reasoning_split is True
|
||||
|
||||
def test_future_m3_inherits_reasoning_split(self):
|
||||
assert get_capabilities("MiniMax-M3-highspeed").requires_reasoning_split is True
|
||||
|
||||
def test_non_reasoning_minimax_does_not_get_reasoning_split(self):
|
||||
# Coding Plan, MiniMax-Text-01, and any non-M2-prefixed MiniMax model
|
||||
# reject the reasoning_split kwarg via the openai SDK's strict
|
||||
# validation (#826). Default capability has it disabled.
|
||||
for model in ("minimax-text-01", "MiniMax-Coding-Plan", "abab6.5-chat"):
|
||||
assert get_capabilities(model).requires_reasoning_split is False
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
class TestDefault:
|
||||
|
||||
@@ -42,6 +42,18 @@ class TestMinimaxReasoningSplit:
|
||||
# the caller passed. setdefault leaves an existing value alone.
|
||||
assert payload.get("reasoning_split") in (False, True)
|
||||
|
||||
def test_non_reasoning_minimax_does_not_inject_reasoning_split(self):
|
||||
"""Coding Plan / MiniMax-Text-01 / any non-M2-prefixed model must NOT
|
||||
receive reasoning_split — the openai SDK rejects unknown kwargs with
|
||||
TypeError (#826)."""
|
||||
for model in ("minimax-text-01", "MiniMax-Coding-Plan"):
|
||||
payload = _client(model)._get_request_payload(
|
||||
[HumanMessage(content="hi")]
|
||||
)
|
||||
assert "reasoning_split" not in payload, (
|
||||
f"{model!r} payload unexpectedly contains reasoning_split"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
class TestMinimaxStructuredOutputDispatch:
|
||||
|
||||
Reference in New Issue
Block a user