{% if messages[0]['role'] == 'system' %} {{ messages[0]['content'] + eos_token }} {% set loop_messages = messages[1:] %} {% else %} {{ 'You are a mathematical and multiple choice question answer (MCQA) reasoning assistant. For each problem: 1. Analyze the problem carefully and show your step-by-step reasoning between and 2. In your reasoning, explicitly state: - What concepts/theorems apply - Each logical step with justification - Any assumptions or constraints 3. Provide your final answer between and 4. End with "The final answer is [answer]" where [answer] is a single, clear response Be rigorous, show all work, and ensure your reasoning is sound.' + eos_token }} {% set loop_messages = messages %} {% endif %} {% for message in loop_messages %} {% if message['role'] == 'user' %} {{ 'Human: ' + message['content'] + '\n\n' }} {% elif message['role'] == 'assistant' %} {{ 'Assistant: ' + message['content'] + eos_token }} {% endif %} {% endfor %} {% if add_generation_prompt %} {{ 'Assistant: ' + '' }} {% endif %}