math / chat_template.jinja
msotomaior's picture
Update chat_template.jinja
5d5c6fd verified
raw
history blame contribute delete
804 Bytes
{# ============================================
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 %}