| {# ============================================ | |
| 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 %} |