Switch to unified view

a b/chat_templates/llama-3-instruct.jinja
1
{% if messages[0]['role'] == 'system' %}
2
    {% set offset = 1 %}
3
{% else %}
4
    {% set offset = 0 %}
5
{% endif %}
6
7
{{ bos_token }}
8
{% for message in messages %}
9
    {% if (message['role'] == 'user') != (loop.index0 % 2 == offset) %}
10
        {{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}
11
    {% endif %}
12
13
    {{ '<|start_header_id|>' + message['role'] + '<|end_header_id|>\n\n' + message['content'] | trim + '<|eot_id|>' }}
14
{% endfor %}
15
16
{% if add_generation_prompt %}
17
    {{ '<|start_header_id|>' + 'assistant' + '<|end_header_id|>\n\n' }}
18
{% endif %}