From dba1a45c0e92fedf16f019f107da81e0ad1cf618 Mon Sep 17 00:00:00 2001 From: Open Source Contributor Date: Sat, 18 Apr 2026 00:06:56 -0600 Subject: [PATCH] fix: MiniMax tool call normalization and thinking block handling --- strix/llm/llm.py | 7 +++++++ strix/llm/utils.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/strix/llm/llm.py b/strix/llm/llm.py index 4f624956..c27ac042 100644 --- a/strix/llm/llm.py +++ b/strix/llm/llm.py @@ -202,6 +202,13 @@ class LLM: accumulated = normalize_tool_format(accumulated) accumulated = fix_incomplete_tool_call(_truncate_to_first_function(accumulated)) + + thinking_content = "" + for match in re.finditer(r"]*>(.*?)", accumulated, re.DOTALL): + thinking_content += match.group(1) + "\n" + if thinking_content: + accumulated = accumulated.replace(thinking_content, "") + yield LLMResponse( content=accumulated, tool_invocations=parse_tool_invocations(accumulated), diff --git a/strix/llm/utils.py b/strix/llm/utils.py index 9771854f..314eee22 100644 --- a/strix/llm/utils.py +++ b/strix/llm/utils.py @@ -20,7 +20,7 @@ def normalize_tool_format(content: str) -> str: """ - if "", content) content = _PARAM_NAME_ATTR.sub(r"", content)