@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / b1687527b8
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 3, 22:45 UTC

[Bugfix] Gemma 4 chat template crash with missing tool name and tool id (#42188)

Signed-off-by: Yifan <yzong@redhat.com>

yzong-rh committed May 10, 2026 at 23:07 UTC b1687527b83649771a543baef1f33aa07b219855
1 file changed +2 -2
examples/tool_chat_template_gemma4.jinja
+2 -2
@@ -263,7 +263,7 @@
263 {%- if message.get('tool_responses') -%}
264 {#- Legacy: tool_responses embedded on the assistant message (Google/Gemma native) -#}
265 {%- for tool_response in message['tool_responses'] -%}
266 - {{- format_tool_response_block(tool_response['name'] | default('unknown'), tool_response['response']) -}}
266 + {{- format_tool_response_block(tool_response['name'] | default('unknown', true), tool_response['response']) -}}
267 {%- set ns_tr_out.flag = true -%}
268 {%- set ns.prev_message_type = 'tool_response' -%}
269 {%- endfor -%}
@@ -277,7 +277,7 @@
277 {%- else -%}
278 {%- set follow = loop_messages[k] -%}
279 {#- Resolve tool_call_id to function name -#}
280 - {%- set ns_tname = namespace(name=follow.get('name') | default('unknown')) -%}
280 + {%- set ns_tname = namespace(name=follow.get('name') | default('unknown', true)) -%}
281 {%- for tc in message['tool_calls'] -%}
282 {%- if tc.get('id') == follow.get('tool_call_id') -%}
283 {%- set ns_tname.name = tc['function']['name'] -%}