[Bugfix] Fix Qwen3 prompt tool-call reasoning false positive (#45763)

Signed-off-by: Alex Bilichenko <alexbi29@users.noreply.github.com>
Co-authored-by: Alex Bilichenko <alexbi29@users.noreply.github.com>
This commit is contained in:
alexbi29
2026-06-16 17:48:01 +00:00
committed by GitHub
co-authored by Alex Bilichenko
parent f00e163f35
commit 7d567172fc
2 changed files with 40 additions and 0 deletions
+6
View File
@@ -206,8 +206,14 @@ class Qwen3Parser(ParserEngine):
return True
tool_call_id = self._tool_call_token_id
tool_call_end_id = self._tool_call_end_token_id
reasoning_start_id = self._reasoning_start_token_id
if tool_call_id is not None:
for i in range(len(input_ids) - 1, -1, -1):
if (
reasoning_start_id is not None
and input_ids[i] == reasoning_start_id
):
return False
if input_ids[i] == tool_call_id:
if tool_call_end_id is not None and any(
input_ids[j] == tool_call_end_id