Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion run_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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":
Expand Down