Potential misalignment between Qwen3.5 chat template and recommended tool parser

#72
by sen-ppl - opened

Qwen3.5's chat template uses | string for scalar tool call argument values, producing Python str() representations instead of JSON literals. This breaks tool call parsing at inference time for models fine-tuned using this chat template.

Qwen3.5 chat template:

{%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}

Only mappings and non-string sequences get tojson. Other types like None go through | string gets converted to "None". So, the model trained on this chat template would emit "None" instead of "null".

Recommended vllm qwen3 coder tool parser which can only parse string "null" but not "None".

Qwen3 coder is fine because its chat template correctly calls tojson on all non-string arguments and converts null to "null"

{%- set args_value = args_value if args_value is string else args_value | tojson | safe %}

Sign up or log in to comment