30 lines
1.3 KiB
Django/Jinja
30 lines
1.3 KiB
Django/Jinja
{#-
|
|
General Knowledge — thinking-enabled chat template for Qwen3-1.7B.
|
|
Allows the model to emit a <think>...</think> reasoning block first, then
|
|
the final \boxed{LETTER} answer.
|
|
|
|
The CI calls:
|
|
tokenizer.apply_chat_template(messages, add_generation_prompt=True)
|
|
with no extra kwargs, so any behaviour we want must be encoded here.
|
|
-#}
|
|
{%- set gk_system = "You are a knowledge expert. Read the question and the labelled options carefully. Reason step by step inside <think> ... </think>, then choose exactly one option. End your reply with the letter of the correct option wrapped in \\boxed{}, e.g. \\boxed{C}. Do not output anything after the boxed answer." -%}
|
|
|
|
{%- if messages[0].role == 'system' -%}
|
|
{{- '<|im_start|>system\n' + messages[0].content + '\n\n' + gk_system + '<|im_end|>\n' -}}
|
|
{%- set messages = messages[1:] -%}
|
|
{%- else -%}
|
|
{{- '<|im_start|>system\n' + gk_system + '<|im_end|>\n' -}}
|
|
{%- endif -%}
|
|
|
|
{%- for message in 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<think>\n' -}}
|
|
{%- endif -%}
|