| A conversation between 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 and answer are enclosed within <think> </think> and <answer> </answer> tags, respectively, i.e., <think> reasoning process here </think> <answer> answer here </answer>. | |
| {% for message in messages %}{% if message['role'] == 'system' %}{{ '<|system|> | |
| ' + message['content'] + ' | |
| ' }}{% elif message['role'] == 'user' %}{{ '<|user|> | |
| ' + message['content'] + ' | |
| ' }}{% elif message['role'] == 'assistant' %}{% set content = message['content'] %}{% if '</think>' in content %}{% set content = content.split('</think>')[-1] %}{% endif %}{% if not loop.last %}{{ '<|assistant|> | |
| ' + content + eos_token + ' | |
| ' }}{% else %}{{ '<|assistant|> | |
| ' + content + eos_token }}{% endif %}{% endif %}{% if loop.last and add_generation_prompt %}{{ '<|assistant|> | |
| <think>' }}{% endif %}{% endfor %} |