[Bugfix] Fix empty delta detection in Qwen3XMLToolParser streaming (#40090)

Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
This commit is contained in:
Chauncey
2026-04-17 13:34:55 +00:00
committed by GitHub
parent d02421a7db
commit 7a51b3e415
2 changed files with 7 additions and 7 deletions
@@ -64,9 +64,6 @@ class TestQwen3xmlToolParser(ToolParserTests):
"test_empty_arguments": "Qwen3XML streaming has systematic issues",
"test_surrounding_text": "Qwen3XML streaming has systematic issues",
"test_escaped_strings": "Qwen3XML streaming has systematic issues",
"test_malformed_input": (
"Qwen3XML parser is lenient with malformed input"
),
"test_streaming_reconstruction": (
"Qwen3XML streaming reconstruction has known issues"
),
+7 -4
View File
@@ -1258,11 +1258,11 @@ class Qwen3XMLToolParser(ToolParser):
return None
# Parse the delta text and get the result
result = self.parser.parse_single_streaming_chunks(delta_text)
delta = self.parser.parse_single_streaming_chunks(delta_text)
# Update tool call tracking arrays based on incremental parsing results
if result and result.tool_calls:
for tool_call in result.tool_calls:
if delta and delta.tool_calls:
for tool_call in delta.tool_calls:
if tool_call.function:
tool_index = (
tool_call.index
@@ -1292,4 +1292,7 @@ class Qwen3XMLToolParser(ToolParser):
self.streamed_args_for_tool[tool_index] += (
tool_call.function.arguments
)
return result
if delta.content is None and not delta.tool_calls and delta.reasoning is None:
# If no content and no tool calls, return None to indicate no update
return None
return delta