"components/vscode:/vscode.git/clone" did not exist on "236cb17d00a14b8b466b4ed9bc8d7d1110f551dd"
Unverified Commit 7a51b3e4 authored by Chauncey's avatar Chauncey Committed by GitHub
Browse files

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


Signed-off-by: default avatarchaunceyjiang <chaunceyjiang@gmail.com>
parent d02421a7
...@@ -64,9 +64,6 @@ class TestQwen3xmlToolParser(ToolParserTests): ...@@ -64,9 +64,6 @@ class TestQwen3xmlToolParser(ToolParserTests):
"test_empty_arguments": "Qwen3XML streaming has systematic issues", "test_empty_arguments": "Qwen3XML streaming has systematic issues",
"test_surrounding_text": "Qwen3XML streaming has systematic issues", "test_surrounding_text": "Qwen3XML streaming has systematic issues",
"test_escaped_strings": "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": ( "test_streaming_reconstruction": (
"Qwen3XML streaming reconstruction has known issues" "Qwen3XML streaming reconstruction has known issues"
), ),
......
...@@ -1258,11 +1258,11 @@ class Qwen3XMLToolParser(ToolParser): ...@@ -1258,11 +1258,11 @@ class Qwen3XMLToolParser(ToolParser):
return None return None
# Parse the delta text and get the result # 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 # Update tool call tracking arrays based on incremental parsing results
if result and result.tool_calls: if delta and delta.tool_calls:
for tool_call in result.tool_calls: for tool_call in delta.tool_calls:
if tool_call.function: if tool_call.function:
tool_index = ( tool_index = (
tool_call.index tool_call.index
...@@ -1292,4 +1292,7 @@ class Qwen3XMLToolParser(ToolParser): ...@@ -1292,4 +1292,7 @@ class Qwen3XMLToolParser(ToolParser):
self.streamed_args_for_tool[tool_index] += ( self.streamed_args_for_tool[tool_index] += (
tool_call.function.arguments 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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment