Repository navigation
Conversation
The Mac server has decoded Qwen `<parameter=k>` values by the tool's JSON schema since 0.3.5 (ashhart#28); the CUDA server's parser still returned every value as a string, so an array parameter reached the client as "[\"a\", \"b\"]" instead of ["a", "b"] and strict clients rejected the call. cuda/reply_text.parse_tool_calls now runs each value through the same tool_parameters.decode_parameter the Mac server uses: array, object, boolean, integer, number and null parameters decode when the text is valid JSON of that type, anything else keeps its exact text. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Sep 29, 2026
Closed
Owner
|
Thank you, @MiaAI-Lab. Typed tool arguments on CUDA are in 0.3.6.3 under your name (fe2b5147). The difference in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR: on CUDA, a Qwen tool call's array, object, number and boolean parameters reach the client as JSON strings. With this change they arrive as typed JSON values, as the Mac server has returned them since 0.3.5 (#28). It changes 6 lines in
cuda/reply_text.pyand reuses the Mac server'sdecode_parameter.The problem
Qwen3.8 writes tool calls as
<function=name><parameter=k>value</parameter></function>. The Mac server decodes each value by the tool's JSON schema (tool_parameters.decode_parameter, from #28).cuda/reply_text.parse_tool_callsnever got that step and keeps every value as text. For example, a research agent'sfinish(paths: array)call on a DGX Spark (0.3.6.2, Qwen3.8 Flash Next, MLX 4-bit):Clients that validate arguments against the schema reject the call, and clients that don't pass a string where the tool expects a list.
The change
parse_tool_callsbuildsparameter_schemas(tools)once per reply. Each<parameter>value then goes throughdecode_parameter(value, schema), the same function and rules the Mac server uses:JSON-bodied and GLM calls are unchanged: they were already typed.
Tests
tests/test_tool_parameter_types.py: the existing parametrized check (8 kinds × 3 stream steps) now also runs the CUDA parser, with and withoutmax_calls.tests/test_glm_tool_calls.py::test_qwen_function_blocks_are_unchanged: this test pinned the difference ("the CUDA server keeps them as text", added in 1fc5915). It now expectsdays: 3from both parsers. If that difference was deliberate, say so and I'll rework this.nvcr.io/nvidia/pytorch:26.07-py3(test_tool_*,test_glm_tool_calls,test_cuda_tool_choice,test_cuda_server_stream,test_server_openai_compat): 132 passed, 5 skipped, 2 failed. The 2 failures are intest_tool_parameters_null.py::test_http_*and fail the same way on unmodifiedmain, because they importmlx, which isn't available on Linux.tensorfold serve Vontra/Qwen3.8-Flash-Next-MLX-4bit-MTP --parallel 4 --kv-dtype int8): afinish(paths: array)call returnspathsas a JSON array, both streamed and non-streamed.🤖 Generated with Claude Code