tabbyAPI-ollama/templates/chatml.jinja
kingbri d6ad17097c Templates: Remove whitespace from metadata
Apparently setting variables also adds extraneous whitespace before
the template itself.

Doing {%- set stop_strings = ["string1"] -%} fixes this issue.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-09-08 12:36:36 -04:00

6 lines
407 B
Django/Jinja

{# Metadata #}
{%- set stop_strings = ["<|im_start|>", "<|im_end|>"] -%}
{# Template #}
{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content']}}{% if (loop.last and add_generation_prompt) or not loop.last %}{{ '<|im_end|>' + '\n'}}{% endif %}{% endfor %}
{% if add_generation_prompt and messages[-1]['role'] != 'assistant' %}{{ '<|im_start|>assistant\n' }}{% endif %}