mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-20 10:11:58 +00:00
fix: route minimax m3 reasoning controls through profile
Follow up PR #46609's api.minimax.io reasoning report by moving the behavior out of the broad run_agent host gate and into the MiniMax provider profile. Only MiniMax-M3 on the documented OpenAI-compatible /v1 route gets reasoning_split/thinking/reasoning_effort; Anthropic-format MiniMax and non-M3 models keep their existing wire shapes. Co-authored-by: goku94123 <gooku94123@gmail.com>
This commit is contained in:
parent
ba3883cd18
commit
49e743985a
5 changed files with 171 additions and 14 deletions
|
|
@ -118,3 +118,115 @@ class TestMinimaxAuxModelNotHighspeed:
|
|||
"is a -highspeed variant — that costs 2x for the same model and "
|
||||
"broke #4082 the first time. Revert to plain M2.7 or M3."
|
||||
)
|
||||
|
||||
|
||||
class TestMinimaxM3OpenAIReasoningWireShape:
|
||||
"""MiniMax-M3 on api.minimax.io/v1 gets MiniMax's OpenAI-compatible knobs."""
|
||||
|
||||
def test_m3_openai_route_requests_reasoning_split_by_default(self):
|
||||
import model_tools # noqa: F401
|
||||
import providers
|
||||
|
||||
profile = providers.get_provider_profile("minimax")
|
||||
assert profile is not None
|
||||
extra_body, top_level = profile.build_api_kwargs_extras(
|
||||
reasoning_config=None,
|
||||
model="MiniMax-M3",
|
||||
base_url="https://api.minimax.io/v1",
|
||||
)
|
||||
assert extra_body == {"reasoning_split": True}
|
||||
assert top_level == {}
|
||||
|
||||
def test_m3_openai_route_maps_explicit_effort_to_adaptive_only(self):
|
||||
import model_tools # noqa: F401
|
||||
import providers
|
||||
|
||||
profile = providers.get_provider_profile("minimax")
|
||||
assert profile is not None
|
||||
extra_body, top_level = profile.build_api_kwargs_extras(
|
||||
reasoning_config={"enabled": True, "effort": "high"},
|
||||
model="MiniMax-M3",
|
||||
base_url="https://api.minimax.io/v1",
|
||||
)
|
||||
assert extra_body == {
|
||||
"reasoning_split": True,
|
||||
"thinking": {"type": "adaptive"},
|
||||
}
|
||||
assert top_level == {}
|
||||
|
||||
def test_m3_openai_route_does_not_send_reasoning_effort(self):
|
||||
import model_tools # noqa: F401
|
||||
import providers
|
||||
|
||||
profile = providers.get_provider_profile("minimax")
|
||||
assert profile is not None
|
||||
extra_body, _top_level = profile.build_api_kwargs_extras(
|
||||
reasoning_config={"enabled": True, "effort": "xhigh"},
|
||||
model="MiniMax-M3",
|
||||
base_url="https://api.minimax.io/v1/",
|
||||
)
|
||||
assert extra_body == {
|
||||
"reasoning_split": True,
|
||||
"thinking": {"type": "adaptive"},
|
||||
}
|
||||
|
||||
def test_m3_openai_route_can_disable_thinking(self):
|
||||
import model_tools # noqa: F401
|
||||
import providers
|
||||
|
||||
profile = providers.get_provider_profile("minimax")
|
||||
assert profile is not None
|
||||
extra_body, top_level = profile.build_api_kwargs_extras(
|
||||
reasoning_config={"enabled": False, "effort": "high"},
|
||||
model="MiniMax-M3",
|
||||
base_url="https://api.minimax.io/v1",
|
||||
)
|
||||
assert extra_body == {
|
||||
"reasoning_split": True,
|
||||
"thinking": {"type": "disabled"},
|
||||
}
|
||||
assert top_level == {}
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"model,base_url",
|
||||
[
|
||||
("MiniMax-M2.7", "https://api.minimax.io/v1"),
|
||||
("MiniMax-M3", "https://api.minimax.io/anthropic"),
|
||||
("MiniMax-M3", "https://api.minimaxi.com/v1"),
|
||||
],
|
||||
)
|
||||
def test_non_m3_or_non_global_openai_routes_emit_no_openai_reasoning_knobs(
|
||||
self, model, base_url
|
||||
):
|
||||
import model_tools # noqa: F401
|
||||
import providers
|
||||
|
||||
profile = providers.get_provider_profile("minimax")
|
||||
assert profile is not None
|
||||
extra_body, top_level = profile.build_api_kwargs_extras(
|
||||
reasoning_config={"enabled": True, "effort": "high"},
|
||||
model=model,
|
||||
base_url=base_url,
|
||||
)
|
||||
assert extra_body == {}
|
||||
assert top_level == {}
|
||||
|
||||
def test_transport_threads_base_url_to_profile(self):
|
||||
import model_tools # noqa: F401
|
||||
import providers
|
||||
from agent.transports.chat_completions import ChatCompletionsTransport
|
||||
|
||||
profile = providers.get_provider_profile("minimax")
|
||||
assert profile is not None
|
||||
kwargs = ChatCompletionsTransport().build_kwargs(
|
||||
model="MiniMax-M3",
|
||||
messages=[{"role": "user", "content": "ping"}],
|
||||
tools=None,
|
||||
provider_profile=profile,
|
||||
reasoning_config={"enabled": True, "effort": "medium"},
|
||||
base_url="https://api.minimax.io/v1",
|
||||
)
|
||||
assert kwargs["extra_body"] == {
|
||||
"reasoning_split": True,
|
||||
"thinking": {"type": "adaptive"},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue