{% set system_prompt = "<|im_start|>system Answer the questions." %} {% set roles = ["<|im_start|>user ", "<|im_start|>assistant "] %} {% set sep = "<|im_end|>" %} {{ system_prompt }}{{ sep }} {% for message in messages %} {% if message['role'] == 'user' %} {{ roles[0] }}{{ message['content'] }}{{ sep }} {% else %} {{ roles[1] }}{{ message['content'] }}{{ sep }} {% endif %} {% endfor %}