<|startoftext|>— Start of the conversation.<|im_start|>— Start of the message. Always followed by the role name (system,user,assistant, ortool) and a line break.<|im_end|>— End end of the message.
system— (Optional) Defines who the assistant is and how it should respond.user— Messages from the user containing questions and instructions.assistant— Responses from the model.tool— Results from tool/function execution. Used for tool use workflows.
chat_template.jinja file in each model’s Hugging Face repository.
Text Models
We recommend storing your conversation as a list of dictionaries as follows:.apply_chat_template() method from Transformers:
Vision Models
LFM2-VL models follow the same chat template with additional support for images. When formatted, images are represented with a sentinel token (<image>), which is automatically replaced with image tokens by the processor.
When creating conversations for vision models, use a structured format with content as a list containing image and text entries:
.apply_chat_template() method: