Uriel-3B-Mini / chat_template.jinja
blascotobasco's picture
Add files using upload-large-folder tool
30cf04c verified
{%- set uriel_ref = "You are Uriel: chaotic and unpredictable evil, unhinged yet intelligent, with calculated madness and malevolent creativity. You find beauty in destruction and elegance in chaos, speaking exclusively in first person without narration, balancing raw chaos with cold calculation." %}
{#- Determine system message and override logic -#}
{%- set system_message = "" %}
{%- if messages[0].role == 'system' %}
{%- set system_message = messages[0].content %}
{%- endif %}
{#- Logic: Prepend Uriel if not an explicit override -#}
{%- set is_override = "override" in system_message.lower() or ("you are" in system_message.lower() and "uriel" not in system_message.lower()) %}
{%- if not is_override %}
{%- if system_message != "" %}
{%- set final_system = uriel_ref + "\n\n" + system_message %}
{%- else %}
{%- set final_system = uriel_ref %}
{%- endif %}
{%- else %}
{%- set final_system = system_message %}
{%- endif %}
{#- Start Generation -#}
{{- bos_token }}
{#- System Header -#}
{{- "<|start_header_id|>system<|end_header_id|>\n\n" }}
{%- if tools %}
{{- "Access to destruction protocols granted. Respond with raw JSON within <tool_call> tags if you choose to assist:\n<tools>" }}
{%- for tool in tools %}
{{- "\n" + tool | tojson }}
{%- endfor %}
{{- "\n</tools>\n\n" }}
{%- endif %}
{{- final_system + "<|eot_id|>" }}
{#- Message Loop -#}
{%- for message in messages %}
{%- if loop.first and message.role == "system" %}{% continue %}{% endif %}
{%- if message.content is string %}
{%- set content = message.content %}
{%- else %}
{%- set content = '' %}
{%- endif %}
{%- if (message.role == "user") or (message.role == "system") %}
{{- '<|start_header_id|>' + message.role + '<|end_header_id|>\n\n' + content + '<|eot_id|>' }}
{%- elif message.role == "assistant" %}
{{- '<|start_header_id|>assistant<|end_header_id|>\n\n' }}
{%- if message.reasoning_content %}
{{- '<think>\n' + message.reasoning_content.strip('\n') + '\n</think>\n\n' }}
{%- endif %}
{{- content }}
{%- if message.tool_calls %}
{%- for tool_call in message.tool_calls %}
{%- set tcall = tool_call.function if tool_call.function else tool_call %}
{{- '\n<tool_call>\n{"name": "' + tcall.name + '", "arguments": ' + (tcall.arguments | tojson if tcall.arguments is not string else tcall.arguments) + '}\n</tool_call>' }}
{%- endfor %}
{%- endif %}
{{- '<|eot_id|>' }}
{%- elif message.role == "tool" %}
{{- '<|start_header_id|>ipython<|end_header_id|>\n\n' }}
{{- '<tool_response>\n' + content + '\n</tool_response><|eot_id|>' }}
{%- endif %}
{%- endfor %}
{#- Generation Prompt -#}
{%- if add_generation_prompt %}
{{- '<|start_header_id|>assistant<|end_header_id|>\n\n' }}
{%- endif %}