llama_chat_template: Get model's built-in chat template

View source: R/llama.R

llama_chat_templateR Documentation

Get model's built-in chat template

Description

Returns the chat template string embedded in the model file, if any. Common templates include ChatML, Llama, Mistral, etc.

Usage

llama_chat_template(model, name = NULL)

Arguments

model

Model handle returned by [llama_load_model]

name

Optional template name (NULL for default)

Value

A character scalar with the chat template string, or NULL if the model does not contain a built-in template.

Examples

## Not run: 
model <- llama_load_model("llama-3.2-instruct.gguf")
tmpl <- llama_chat_template(model)
cat(tmpl)

## End(Not run)

llamaR documentation built on May 28, 2026, 1:06 a.m.