osanseviero harshaljanjani commited on
Commit
fcf2302
·
1 Parent(s): ba74f5b

fix(chat_template): Emit multimodal placeholders in tool response content-parts (#94)

Browse files

- fix(chat_template): Emit multimodal placeholders in tool response content-parts (7d0815aac6c197933a8f76ef360a5e9d099264bf)


Co-authored-by: Harshal Janjani <harshaljanjani@users.noreply.huggingface.co>

Files changed (1) hide show
  1. chat_template.jinja +9 -0
chat_template.jinja CHANGED
@@ -295,6 +295,15 @@
295
  {%- endif -%}
296
  {%- endfor -%}
297
  {{- format_tool_response_block(ns_tname.name, ns_txt.s) -}}
 
 
 
 
 
 
 
 
 
298
  {%- else -%}
299
  {{- format_tool_response_block(ns_tname.name, tool_body) -}}
300
  {%- endif -%}
 
295
  {%- endif -%}
296
  {%- endfor -%}
297
  {{- format_tool_response_block(ns_tname.name, ns_txt.s) -}}
298
+ {%- for part in tool_body -%}
299
+ {%- if part.get('type') == 'image' -%}
300
+ {{- '<|image|>' -}}
301
+ {%- elif part.get('type') == 'audio' -%}
302
+ {{- '<|audio|>' -}}
303
+ {%- elif part.get('type') == 'video' -%}
304
+ {{- '<|video|>' -}}
305
+ {%- endif -%}
306
+ {%- endfor -%}
307
  {%- else -%}
308
  {{- format_tool_response_block(ns_tname.name, tool_body) -}}
309
  {%- endif -%}