Category S: Chat Templates

Chat template formatting for LLM inference, mirroring the apr chat CLI subcommand. Each recipe implements a specific template format from scratch, showing exact byte-level structure with special tokens.

Recipes

RecipeDescriptionStatus
ChatMLChatML template format (OpenAI, Qwen, Yi)Verified
LLaMA 2LLaMA 2 chat template with [INST] delimitersVerified
MistralMistral Instruct template (no native system role)Verified
Multi-FormatAuto-detect and apply correct template by model nameVerified
Injection DefensePrompt injection detection and sanitizationVerified