| {# Minimal, no tools, Llama-3 headers; ends turns with <|eot_id|> #} | |
| {%- set default_system = 'You are a math problem solving assistant. Read the given math problem, reason your thoughts and approach in <think>...</think> tags and provide the final answer as a (\\boxed{}\\) value\n\n' -%} | |
| {# System message (use provided one if present, else a tiny default) #} | |
| {%- if messages and messages[0]['role'] == 'system' -%} | |
| <|start_header_id|>system<|end_header_id|> | |
| {{ messages[0]['content'] }} | |
| <|eot_id|> | |
| {%- else -%} | |
| <|start_header_id|>system<|end_header_id|> | |
| {{ default_system }} | |
| <|eot_id|> | |
| {%- endif -%} | |
| {# Render all remaining messages (user / assistant) #} | |
| {%- for m in messages -%} | |
| {%- if not (loop.first and m.role == 'system') -%} | |
| <|start_header_id|>{{ m.role }}<|end_header_id|> | |
| {{ m.content }} | |
| <|eot_id|> | |
| {%- endif -%} | |
| {%- endfor -%} | |
| {# When generation is requested, open the assistant header #} | |
| {%- if add_generation_prompt -%} | |
| <|start_header_id|>assistant<|end_header_id|> | |
| {%- endif -%} |