mrtoots commited on
Commit
afa7924
·
verified ·
1 Parent(s): 1e58477

Upload chat_template.jinja with huggingface_hub

Browse files
Files changed (1) hide show
  1. chat_template.jinja +5 -3
chat_template.jinja CHANGED
@@ -1,3 +1,4 @@
 
1
  [gMASK]<sop>
2
  {%- if tools -%}
3
  <|system|>
@@ -8,7 +9,7 @@ You may call one or more functions to assist with the user query.
8
  You are provided with function signatures within <tools></tools> XML tags:
9
  <tools>
10
  {% for tool in tools %}
11
- {{ tool | tojson(ensure_ascii=False) }}
12
  {% endfor %}
13
  </tools>
14
 
@@ -63,7 +64,7 @@ For each function call, output the function name and arguments within the follow
63
  {%- set tc = tc.function %}
64
  {%- endif %}
65
  {{- '<tool_call>' + tc.name -}}
66
- {% set _args = tc.arguments %}{% for k, v in _args.items() %}<arg_key>{{ k }}</arg_key><arg_value>{{ v | tojson(ensure_ascii=False) if v is not string else v }}</arg_value>{% endfor %}</tool_call>{% endfor %}
67
  {% endif %}
68
  {%- elif m.role == 'tool' -%}
69
  {%- if m.content is string -%}
@@ -83,4 +84,5 @@ For each function call, output the function name and arguments within the follow
83
  {%- endfor -%}
84
  {%- if add_generation_prompt -%}
85
  <|assistant|>{{- '</think>' if (enable_thinking is defined and not enable_thinking) else '<think>' -}}
86
- {%- endif -%}
 
 
1
+ {# Unsloth template fixes #}
2
  [gMASK]<sop>
3
  {%- if tools -%}
4
  <|system|>
 
9
  You are provided with function signatures within <tools></tools> XML tags:
10
  <tools>
11
  {% for tool in tools %}
12
+ {{ tool | tojson|string }}
13
  {% endfor %}
14
  </tools>
15
 
 
64
  {%- set tc = tc.function %}
65
  {%- endif %}
66
  {{- '<tool_call>' + tc.name -}}
67
+ {% set _args = tc.arguments %}{% if _args is mapping %}{% for k, v in _args|items %}<arg_key>{{ k }}</arg_key><arg_value>{{ v | tojson|string if v is not string else v }}</arg_value>{% endfor %}{%- endif %}</tool_call>{% endfor %}
68
  {% endif %}
69
  {%- elif m.role == 'tool' -%}
70
  {%- if m.content is string -%}
 
84
  {%- endfor -%}
85
  {%- if add_generation_prompt -%}
86
  <|assistant|>{{- '</think>' if (enable_thinking is defined and not enable_thinking) else '<think>' -}}
87
+ {%- endif -%}
88
+ {# Copyright 2025-present Unsloth. Apache 2.0 License. #}