Expand description
Chat formatting for each model family (mirrors their chat templates), including tool calling.
Structs§
- Gemma3
Chat - Gemma 3:
<start_of_turn>turns, no system role (the system prompt opens the first user turn), no thinking and no tool tokens. - Gemma
Chat - Llama3
Chat - Llama 3.x instruct: header-delimited turns; the template always opens with a system turn
carrying the knowledge cutoff and today’s date (“25 Oct 2026”, as
strftime_now("%d %b %Y")). - Qwen2
Chat - Qwen2 / Qwen2.5 ChatML: like Qwen3 without thinking, and the template’s default system prompt when none is given.
- Qwen
Chat - Qwen ChatML templates. Qwen3.5 / 3.8: thinking is on by default in the model, so a non-thinking request closes the think block in the generation prompt, and a thinking one opens it; Qwen3.8’s also adds a reasoning-effort instruction to the system turn in thinking mode (and a small model given that instruction anyway can deliberate about it endlessly). Qwen3: the model opens its own think block, and tools are declared and called in JSON.
Constants§
Statics§
- QWEN
- Qwen3.5, Qwen3.8 (with the reasoning-effort instruction) and Qwen3 formats.
- QWEN3
- QWEN_
EFFORT
Traits§
- Chat
Format - Chat formatting for a model family.
Functions§
- conversation_
start - Text for the start of a conversation:
<bos>plus the optional system turn. - end_
of_ model_ turn - Text to append after the model has finished its reply (before the next user turn).
- user_
turn - A user turn followed by the generation prompt for the model.
- with_
turn_ end eosplus the chat format’s end-of-turn token, looked up in the tokenizer.