From 4468e987c439ab90db37f48eae43b248726298ef Mon Sep 17 00:00:00 2001 From: GMYXDS Date: Wed, 13 May 2026 23:16:46 +0800 Subject: [PATCH] Add MiMo tool reasoning check Added a new method to check for Xiaomi MiMo thinking mode and updated the reasoning checks. --- run_agent.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/run_agent.py b/run_agent.py index f2f3379e0d78e..ed5eaf37561f6 100644 --- a/run_agent.py +++ b/run_agent.py @@ -9987,6 +9987,7 @@ def _needs_thinking_reasoning_pad(self) -> bool: return ( self._needs_deepseek_tool_reasoning() or self._needs_kimi_tool_reasoning() + or self._needs_mimo_tool_reasoning() # new ) def _needs_kimi_tool_reasoning(self) -> bool: @@ -10017,7 +10018,22 @@ def _needs_deepseek_tool_reasoning(self) -> bool: or "deepseek" in model or base_url_host_matches(self.base_url, "api.deepseek.com") ) - + + def _needs_mimo_tool_reasoning(self) -> bool: + """Return True when the current provider is Xiaomi MiMo thinking mode. + + MiMo thinking mode requires ``reasoning_content`` on every assistant + message when replaying conversation history. Omitting it causes HTTP 400 + ("The reasoning_content in the thinking mode must be passed back to the API"). + """ + provider = (self.provider or "").lower() + model = (self.model or "").lower() + return ( + provider == "mimo" + or "mimo" in model + or base_url_host_matches(self.base_url, "xiaomimimo.com") + ) + def _copy_reasoning_content_for_api(self, source_msg: dict, api_msg: dict) -> None: """Copy provider-facing reasoning fields onto an API replay message.""" if source_msg.get("role") != "assistant":