Formats chat messages into model‑specific prompt templates for LLMs.
// Source: https://github.com/moltis-org/moltis | License: MIT | Copyright 2025 Fabien Penso
// Provided via justclaw.it.com; keep this notice with the code.
//! Chat template formatting for various model families.
//!
//! Different LLM families use different prompt formats. This module provides
//! template formatting for Llama3, ChatML (Qwen/Kimi), Mistral, and DeepSeek.
use moltis_agents::model::{ChatMessage, UserContent};
/// Hint for which chat template to use.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum ChatTemplateHint {
/// Try to use the model's embedded template, fall back to ChatML.
#[default]
Auto,
/// Llama 3 format: `<|begin_of_text|><|start_header_id|>system<|end_header_id|>...`
Llama3,
/// ChatML format: `<|im_start|>system\n...<
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key