Skip to content

fix bug: serialize Qwen tool argument JSON literals - #9968

Merged
tastelikefeet merged 1 commit into
modelscope:mainfrom
Zhijun-Xu:fix/qwen-tool-json-literals
Aug 24, 2026
Merged

fix bug: serialize Qwen tool argument JSON literals#9968
tastelikefeet merged 1 commit into
modelscope:mainfrom
Zhijun-Xu:fix/qwen-tool-json-literals

Conversation

@Zhijun-Xu

Copy link
Copy Markdown
Contributor

Qwen's native chat template serializes non-string tool arguments as JSON. However, the Swift formatter only applied JSON serialization to dictionaries and lists, causing booleans and null values to use Python literals.

For example:

{"enabled": true, "optional": null}

Previously rendered as:

<parameter=enabled>
True
</parameter>
<parameter=optional>
None
</parameter>

This PR renders them using the expected JSON literals:

<parameter=enabled>
true
</parameter>
<parameter=optional>
null
</parameter>

The change only extends the existing JSON serialization path to bool and None. Other argument types retain their previous behavior.

@tastelikefeet
tastelikefeet merged commit ec8d1b0 into modelscope:main Aug 24, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants