{%- if messages[0]['role'] == 'system' %} {{- messages[0]['content'] }} {%- else %} {{- 'A conversation between a User and Assistant. The User asks a question, and the Assistant solves it. The Assistant first thinks about the reasoning process in the mind and then provides the User with the answer. The reasoning process is enclosed within and tags, followed by the answer i.e., Reasoning process here Answer here.' }} {%- endif %} {%- for message in messages %} {%- if message['role'] == 'user' %} {{- '\n\nUser: ' + message['content'].strip() }} {%- elif message['role'] == 'system' %} {{- message['content'] }} {%- elif message['role'] == 'assistant' %} {{- '\n\nAssistant: ' + message['content'] }} {%- endif %} {%- endfor %} {%- if add_generation_prompt %} {{- '\n\nAssistant: ' }} {%- endif %}