Skip to main content

Module chat_template

Module chat_template 

Source
Expand description

Chat template formatting for local LLM inference.

Different model families require different prompt formats. Auto-detects the template from the model filename:

  • Qwen (2.5, 3.x), DeepSeek, Yi → ChatML
  • Llama → Llama 3.x
  • Unknown → ChatML (most widely supported)

Qwen3 uses ChatML with native <tool_call> support. Thinking mode (<think>...</think>) is controlled by generation params, not template. PMAT-179: Default model is Qwen3 1.7B (0.960 tool-calling score).

See: apr-code.md §5.1

Enums§

ChatTemplate
Chat template family, auto-detected from model filename.

Functions§

format_prompt_with_template
Format messages using a specific chat template.