{% set system_prompt = "A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions." %} {% set roles = ["USER", "ASSISTANT"] %} {% set sep = " " %} {% set sep2 = "" %} {{ system_prompt }} {% for message in messages %} {% if message['role'] == roles[0] %} {{ roles[0] }}{{ sep }}{{ message['content'] }}{{ sep2 }} {% else %} {{ roles[1] }}{{ sep }}{{ message['content'] }}{{ sep2 }} {% endif %} {% endfor %}