dragon.ai.inference.llm_engine.chat_template_formatter
- chat_template_formatter(system_prompt, user_prompt, chat_history, model_name)[source]
Format the prompt using the model’s chat template via its tokenizer.
Builds an OpenAI-format message list and applies the model’s native chat template using
AutoTokenizer.apply_chat_template().- Parameters:
system_prompt (str or list[str]) – System prompt to be included in the chat.
user_prompt (str) – User prompt to be included in the chat.
chat_history (list[dict]) – Previous chat history as a list of message dicts with
roleandcontentkeys.model_name (str) – Name/path of the model (used to load tokenizer).
- Returns:
Formatted prompt string ready for the LLM.
- Return type: