| {{ bos_token }}{% if messages[0]['role'] == 'system' %}{{'<start_of_turn>user | |
| ' + messages[0]['content'] | trim + ' ' + messages[1]['content'] | trim + '<end_of_turn> | |
| '}}{% set messages = messages[2:] %}{% endif %}{% for message in messages %}{% if message['role'] == 'user' %}{{'<start_of_turn>user | |
| ' + message['content'] | trim + '<end_of_turn> | |
| '}}{% elif message['role'] == 'assistant' %}{{'<start_of_turn>model | |
| ' + message['content'] | trim + '<end_of_turn> | |
| ' }}{% else %}{{ raise_exception('Only user and assistant roles are supported!') }}{% endif %}{% endfor %}{% if add_generation_prompt %}{{ '<start_of_turn>model | |
| ' }}{% endif %} |