File size: 804 Bytes
5d5c6fd
 
 
 
 
 
 
 
 
 
 
8065b3f
5d5c6fd
8065b3f
5d5c6fd
 
 
 
 
 
 
 
 
8065b3f
5d5c6fd
8065b3f
5d5c6fd
8065b3f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{# ============================================
   Simple ChatML template (NO <think>, NO tools)
   - Compatible with many LLaMA-style chat models
   - Prevents "THINKING/ANSWER" scaffolding by not
     prompting for reasoning channels.
   ============================================ #}

{%- if messages[0].role == 'system' %}
{{- '<|im_start|>system\n' -}}
{{- messages[0].content -}}
{{- '<|im_end|>\n' -}}
{%- endif %}

{%- for message in messages %}
  {%- if message.role == 'system' and loop.first %}
    {# already emitted above #}
  {%- else %}
{{- '<|im_start|>' + message.role + '\n' -}}
{%- if message.content is string -%}
{{- message.content -}}
{%- endif -%}
{{- '<|im_end|>\n' -}}
  {%- endif %}
{%- endfor %}

{%- if add_generation_prompt %}
{{- '<|im_start|>assistant\n' -}}
{%- endif %}