Skip to content

Incorrect Variable Names in Qwen3.5 Chat Template Handler #102

@abdullah-cod9

Description

@abdullah-cod9

tool_response was being added to the conversation without tool_call, causing malformed chat sequences.

Variable
- {%- for tool_call in message.tool_call -%}
+ {%- for tool_call in message.tool_calls -%}

- {{- '<parameter=' + args.name + '>\n' -}}
+ {{- '<parameter=' + args_name + '>\n' -}}

After applying the above fixes, the following error surfaced:

packages\jinja2\filters.py", line 249, in do_items
    raise TypeError("Can only get item pairs from a mapping.")

So, passing the tool_call arguments as a dict worked for me.

After these changes, tool_call is now added before tool_response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions