Update chat_template.jinja

#3
by quark2world - opened

vLLM converts tool message content from string to list of content parts
[{"type": "text", "text": "..."}] before passing to the chat template.

The template only checks m.content is string, so tool results fall
into the else branch and render as empty . The model
then cannot see any tool output.

This adds handling for the iterable content parts format between the
existing string and else branches.

Affects vLLM tool calling with GLM-5.1 and likely GLM-5 as well.

Thanks for identifying this issue and taking the time to submit a fix!

Unfortunately we can't merge this PR as-is, because the new elif m.content is iterable and m.content is not mapping branch is too broad β€” it also captures tool_reference content (used by our defer_loading feature), which causes that path to silently produce an empty <tool_response></tool_response> and breaks deferred tool loading entirely.

We've already pushed an updated template that addresses the array content handling while preserving the tool_reference path. Thanks again for the report and the contribution β€” really appreciated!

ZHANGYUXUAN-zR changed pull request status to closed

Sign up or log in to comment