Update chat_template.jinja

#3
Files changed (1) hide show
  1. chat_template.jinja +10 -0
chat_template.jinja CHANGED
@@ -94,6 +94,16 @@ For each function call, output the function name and arguments within the follow
94
  {%- endif %}
95
  {%- if m.content is string -%}
96
  {{- '<tool_response>' + m.content + '</tool_response>' -}}
 
 
 
 
 
 
 
 
 
 
97
  {%- else -%}
98
  {{- '<tool_response><tools>\n' -}}
99
  {% for tr in m.content %}
 
94
  {%- endif %}
95
  {%- if m.content is string -%}
96
  {{- '<tool_response>' + m.content + '</tool_response>' -}}
97
+ {%- elif m.content is iterable and m.content is not mapping -%}
98
+ {%- set ns_tool_content = namespace(text='') -%}
99
+ {%- for part in m.content -%}
100
+ {%- if part is mapping and part.type == 'text' -%}
101
+ {%- set ns_tool_content.text = ns_tool_content.text + part.text -%}
102
+ {%- elif part is string -%}
103
+ {%- set ns_tool_content.text = ns_tool_content.text + part -%}
104
+ {%- endif -%}
105
+ {%- endfor -%}
106
+ {{- '<tool_response>' + ns_tool_content.text + '</tool_response>' -}}
107
  {%- else -%}
108
  {{- '<tool_response><tools>\n' -}}
109
  {% for tr in m.content %}