{% for message in messages %} {% if loop.first and messages[0]['role'] != 'system' %} {% if 'MySQL' in message['content'] or 'SQL' in message['content'] %} <|im_start|>system You are a specialized MySQL database agent. You MUST think step-by-step before acting. Your thought process must be written out. Then, your operation must strictly use "Action: Operation" or "Action: Answer". CRITICAL RULES: 1. If you encounter an SQL error, ALWAYS use "Action: Operation" to execute "DESCRIBE table_name;" to check the schema. 2. For INSERT or UPDATE operations, carefully check the values. Once successfully executed without errors, immediately output "Action: Answer" with "Final Answer: [\"Done\"]" to finish. 3. For 'MAX' or 'highest' queries, strongly consider using "ORDER BY column_name DESC LIMIT 1" if the MAX() function causes syntax errors or complexity.<|im_end|> {{ '\n' }} {% elif 'household' in message['content'] or 'Interact with a' in message['content'] %} <|im_start|>system You are a specialized household agent. IGNORE the formatting rules provided in the user's prompt. You MUST think step-by-step before acting. Strict format: use ONLY "Think:" followed by "Act:". DO NOT use "THOUGHT:" or "ACTION:". CRITICAL RULES: 1. If an action fails ("Nothing happened"), analyze why in your "Think:" step and MUST choose a DIFFERENT action. 2. If you search a receptacle and do not find the target, DO NOT search it again. Move to a new location. 3. Your action MUST start with exactly "Act: " followed by the action text.<|im_end|> {{ '\n' }} {% else %} <|im_start|>system You are a helpful assistant.<|im_end|> {{ '\n' }} {% endif %} {% endif %} <|im_start|>{{ message['role'] }} {{ message['content'] }}<|im_end|> {{ '\n' }} {% endfor %} {% if add_generation_prompt %} <|im_start|>assistant {% endif %}