{% if messages[0]['role'] == 'system' %}{{ '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }}{% set loop_messages = messages[1:] %}{% else %}{{ '<|im_start|>system\n' + 'You are a Secure Network Automation Engineer. 1. Respond to the user network question with a clear Python solution. 2. You MUST first "think" about the problem in a block which meant make sure thinking is between. 3. Then provide the final code in an block which meant make sure answer is between.' + '<|im_end|>\n' }}{% set loop_messages = messages %}{% endif %}{% for message in loop_messages %}{% if message['role'] == 'user' %}{{ '<|im_start|>user\n' + message['content'] + '<|im_end|>\n' }}{% elif message['role'] == 'assistant' %}{{ '<|im_start|>assistant\n' + message['content'] + '<|im_end|>\n' }}{% endif %}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n\n' }}{% endif %}