@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 762022cafb
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 4, 13:45 UTC

[Bugfix] DSV32/V4 add missing type conversion for non-streaming tool calls (#41198)

Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>

Chauncey committed Apr 29, 2026 at 17:55 UTC 762022cafb1afc4c51ce706c043e2f1f5826003a
2 files changed +26 -1
tests/tool_parsers/test_deepseekv32_tool_parser.py
+24
@@ -188,6 +188,30 @@ class TestExtractToolCalls:
188 "location": "NYC"
189 }
190
191 + def test_type_conversion_in_non_streaming(self):
192 + """Non-streaming extraction must convert params using the tool schema."""
193 + tool = ChatCompletionToolsParam(
194 + function=FunctionDefinition(
195 + name="toggle",
196 + parameters={
197 + "type": "object",
198 + "properties": {
199 + "enabled": {"type": "boolean"},
200 + "count": {"type": "integer"},
201 + },
202 + },
203 + ),
204 + )
205 + parser = make_parser(tools=[tool])
206 + model_output = build_tool_call("toggle", {"enabled": "true", "count": "42"})
207 + result = parser.extract_tool_calls(model_output, None)
208 + assert result.tools_called
209 + assert len(result.tool_calls) == 1
210 + args = json.loads(result.tool_calls[0].function.arguments)
211 + assert args == {"enabled": True, "count": 42}
212 + assert isinstance(args["enabled"], bool)
213 + assert isinstance(args["count"], int)
214 +
215
216 # ---------------------------------------------------------------------------
217 # Tests: extract_tool_calls_streaming
vllm/tool_parsers/deepseekv32_tool_parser.py
+2 -1
@@ -191,12 +191,13 @@ class DeepSeekV32ToolParser(ToolParser):
191 tool_call_match
192 ):
193 param_dict = self._parse_invoke_params(invoke_content)
194 + params = self._convert_params_with_schema(invoke_name, param_dict)
195 tool_calls.append(
196 ToolCall(
197 type="function",
198 function=FunctionCall(
199 name=invoke_name,
199 - arguments=json.dumps(param_dict, ensure_ascii=False),
200 + arguments=json.dumps(params, ensure_ascii=False),
201 ),
202 )
203 )