Upload tokenizer
Browse files- chat_template.jinja +30 -7
chat_template.jinja
CHANGED
|
@@ -1,8 +1,31 @@
|
|
| 1 |
-
{%
|
| 2 |
-
{
|
| 3 |
-
|
| 4 |
-
{
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
{% endif %}
|
|
|
|
| 1 |
+
{% if tools %}<|im_start|>system
|
| 2 |
+
{% if messages[0].role == 'system' %}{{ messages[0].content }}
|
| 3 |
+
|
| 4 |
+
{% endif %}# Tools
|
| 5 |
+
|
| 6 |
+
You may call one or more functions to assist with the user query.
|
| 7 |
+
|
| 8 |
+
You are provided with function signatures within <tools></tools> XML tags:
|
| 9 |
+
<tools>{% for tool in tools %}
|
| 10 |
+
{{ tool | tojson }}{% endfor %}
|
| 11 |
+
</tools>
|
| 12 |
+
|
| 13 |
+
For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:
|
| 14 |
+
<tool_call>
|
| 15 |
+
{"name": <function-name>, "arguments": <args-json-object>}
|
| 16 |
+
</tool_call><|im_end|>
|
| 17 |
+
{% else %}{% if messages[0].role == 'system' %}<|im_start|>system
|
| 18 |
+
{{ messages[0].content }}<|im_end|>
|
| 19 |
+
{% endif %}{% endif %}{% for message in messages %}{% if message.content is string %}{% set content = message.content %}{% else %}{% set content = '' %}{% endif %}{% if (message.role == "user") or (message.role == "system" and not loop.first) %}<|im_start|>{{ message.role }}
|
| 20 |
+
{{ content }}<|im_end|>
|
| 21 |
+
{% elif message.role == "assistant" %}<|im_start|>{{ message.role }}
|
| 22 |
+
{{ content }}{% if message.tool_calls %}{% for tool_call in message.tool_calls %}{% if (loop.first and content) or (not loop.first) %}
|
| 23 |
+
{% endif %}{% if tool_call.function %}{% set tool_call = tool_call.function %}{% endif %}<tool_call>
|
| 24 |
+
{"name": "{{ tool_call.name }}", "arguments": {% if tool_call.arguments is string %}{{ tool_call.arguments }}{% else %}{{ tool_call.arguments | tojson }}{% endif %}}
|
| 25 |
+
</tool_call>{% endfor %}{% endif %}<|im_end|>
|
| 26 |
+
{% elif message.role == "tool" %}{% if loop.first or (messages[loop.index0 - 1].role != "tool") %}<|im_start|>user{% endif %}
|
| 27 |
+
<tool_response>
|
| 28 |
+
{{ content }}
|
| 29 |
+
</tool_response>{% if loop.last or (messages[loop.index0 + 1].role != "tool") %}<|im_end|>
|
| 30 |
+
{% endif %}{% endif %}{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant
|
| 31 |
{% endif %}
|