mirror of
https://github.com/TauricResearch/TradingAgents.git
synced 2026-06-16 21:06:15 +03:00
fix(llm): send MiniMax reasoning_split via extra_body so the openai SDK accepts it (#826)
This commit is contained in:
@@ -25,34 +25,22 @@ def _client(model: str = "MiniMax-M2.7"):
|
||||
|
||||
@pytest.mark.unit
|
||||
class TestMinimaxReasoningSplit:
|
||||
def test_request_payload_sets_reasoning_split(self):
|
||||
def test_reasoning_split_sent_via_extra_body_not_top_level(self):
|
||||
# Must be in extra_body, not top-level: the openai SDK validates
|
||||
# top-level params and rejects unknown ones like reasoning_split (#826).
|
||||
payload = _client()._get_request_payload([HumanMessage(content="hi")])
|
||||
assert payload.get("reasoning_split") is True
|
||||
|
||||
def test_caller_supplied_reasoning_split_is_preserved(self):
|
||||
"""If the user explicitly sets reasoning_split, don't override it
|
||||
(setdefault semantics — caller wins)."""
|
||||
client = _client()
|
||||
payload = client._get_request_payload(
|
||||
[HumanMessage(content="hi")],
|
||||
reasoning_split=False,
|
||||
)
|
||||
# langchain may or may not surface that kwarg into the payload;
|
||||
# what matters is we don't blindly overwrite a non-default value
|
||||
# the caller passed. setdefault leaves an existing value alone.
|
||||
assert payload.get("reasoning_split") in (False, True)
|
||||
assert payload.get("extra_body", {}).get("reasoning_split") is True
|
||||
assert "reasoning_split" not in payload # never top-level
|
||||
|
||||
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)."""
|
||||
receive reasoning_split at all (top-level or extra_body) (#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"
|
||||
)
|
||||
assert "reasoning_split" not in payload
|
||||
assert "reasoning_split" not in payload.get("extra_body", {})
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
|
||||
Reference in New Issue
Block a user