Files
llm-jp-4-kappa-32b-a3b-v0.1/chat_template.jinja

64 lines
2.1 KiB
Plaintext
Raw Normal View History

{#-
Simplified Harmony chat template for GRPO training (no tool support).
Based on the official llm-jp-4 chat_template.jinja.
-#}
{#- System Message Construction -#}
{%- macro build_system_message() -%}
{%- if model_identity is not defined %}
{%- set model_identity = "You are LLM-jp-4, a large language model trained by LLM-jp." %}
{%- endif %}
{{- model_identity + "\n" -}}
{%- if knowledge_cutoff is not defined %}
{%- set knowledge_cutoff = "2025-12" %}
{%- endif %}
{{- "Knowledge cutoff: " + knowledge_cutoff + "\n" -}}
{%- if conversation_start_date is not defined %}
{%- set conversation_start_date = "2026-04-14" %}
{%- endif %}
{{- "Current date: " + conversation_start_date + "\n\n" }}
{%- if reasoning_effort is not defined %}
{%- set reasoning_effort = "medium" %}
{%- endif %}
{{- "Reasoning: " + reasoning_effort + "\n\n" }}
{{- "# Valid channels: analysis, commentary, final. Channel must be included for every message." }}
{%- endmacro -%}
{#- Main Template Logic -#}
{{- "<|start|>system<|message|>" }}
{{- build_system_message() }}
{{- "<|end|>" }}
{%- if messages[0].role == "developer" or messages[0].role == "system" %}
{%- set developer_message = messages[0].content %}
{%- set loop_messages = messages[1:] %}
{%- else %}
{%- set developer_message = "" %}
{%- set loop_messages = messages %}
{%- endif %}
{%- if developer_message %}
{{- "<|start|>developer<|message|>" }}
{{- "# Instructions\n\n" }}
{{- developer_message }}
{{- "<|end|>" }}
{%- endif %}
{%- for message in loop_messages -%}
{%- if message.role == 'assistant' -%}
{%- if loop.last and not add_generation_prompt %}
{%- if "thinking" in message %}
{{- "<|start|>assistant<|channel|>analysis<|message|>" + message.thinking + "<|end|>" }}
{%- endif %}
{{- "<|start|>assistant<|channel|>final<|message|>" + message.content + "<|return|>" }}
{%- else %}
{{- "<|start|>assistant<|channel|>final<|message|>" + message.content + "<|end|>" }}
{%- endif %}
{%- elif message.role == 'user' -%}
{{- "<|start|>user<|message|>" + message.content + "<|end|>" }}
{%- endif -%}
{%- endfor -%}
{%- if add_generation_prompt -%}
<|start|>assistant
{%- endif -%}