| {% set system_message = 'You are given a problem. Think about the problem and provide your reasoning. Place it between <reasoning> and </reasoning>. Then, provide the final answer between <answer> and </answer>.' %}{% set first_user_handled = false %}{% for message in messages %}{% if message['role'] == 'user' %}{% if not first_user_handled %}<start_of_turn>user | |
| {{ system_message }} | |
| {{ message['content'] }}<end_of_turn> | |
| {% set first_user_handled = true %}{% else %}<start_of_turn>user | |
| {{ message['content'] }}<end_of_turn> | |
| {% endif %}{% elif message['role'] == 'assistant' %}<start_of_turn>model | |
| {{ message['content'] }}<end_of_turn> | |
| {% endif %}{% endfor %}{% if add_generation_prompt %}<start_of_turn>model | |
| {% endif %} |