Add base model with custom chat template
Browse files- chat_template.jinja +4 -1
chat_template.jinja
CHANGED
|
@@ -1,4 +1,7 @@
|
|
| 1 |
<|im_start|>{% for message in messages %}{% if message['role'] == 'system' %}System: {% for line in message['content'] %}{% if line['type'] == 'text' %}{{line['text']}}{% endif %}{% endfor %}<|im_end|>
|
| 2 |
{% elif message['role'] == 'tool' %}Tool: {% for line in message['content'] %}{% if line['type'] == 'text' %}{{line['text']}}{% endif %}{% endfor %}<end_of_utterance>
|
| 3 |
-
{%
|
|
|
|
|
|
|
|
|
|
| 4 |
{% endif %}{% endfor %}{% if add_generation_prompt %}{{ 'Assistant:' }}{% endif %}
|
|
|
|
| 1 |
<|im_start|>{% for message in messages %}{% if message['role'] == 'system' %}System: {% for line in message['content'] %}{% if line['type'] == 'text' %}{{line['text']}}{% endif %}{% endfor %}<|im_end|>
|
| 2 |
{% elif message['role'] == 'tool' %}Tool: {% for line in message['content'] %}{% if line['type'] == 'text' %}{{line['text']}}{% endif %}{% endfor %}<end_of_utterance>
|
| 3 |
+
{% elif message['role'] == 'assistant' and message.get('tool_calls') %}{{message['role'] | capitalize}}: {% for line in message['content'] %}{% if line['type'] == 'text' %}{{line['text']}}{% elif line['type'] == 'image' %}{{ '<image>' }}{% endif %}{% endfor %}{% if message['tool_calls'] %}<tool_calls>
|
| 4 |
+
{% for tool_call in message['tool_calls'] %}{"id": "{{tool_call['id']}}", "type": "{{tool_call['type']}}", "function": {"name": "{{tool_call['function']['name']}}", "arguments": "{{tool_call['function']['arguments']}}"}}
|
| 5 |
+
{% endfor %}</tool_calls>{% endif %}<end_of_utterance>
|
| 6 |
+
{% else %}{{message['role'] | capitalize}}{% if message['content'][0]['type'] == 'image' %}{{':'}}{% else %}{{': '}}{% endif %}{% if message['role'] == 'assistant' %}{% generation %}{% for line in message['content'] %}{% if line['type'] == 'text' %}{{line['text']}}{% elif line['type'] == 'image' %}{{ '<image>' }}{% endif %}{% endfor %}{% endgeneration %}{% else %}{% for line in message['content'] %}{% if line['type'] == 'text' %}{{line['text']}}{% elif line['type'] == 'image' %}{{ '<image>' }}{% endif %}{% endfor %}{% endif %}<end_of_utterance>
|
| 7 |
{% endif %}{% endfor %}{% if add_generation_prompt %}{{ 'Assistant:' }}{% endif %}
|