smart_chat_template: Smart Chat Template Application

View source: R/gemma_chat_template.R

smart_chat_templateR Documentation

Smart Chat Template Application

Description

Automatically detects the model type and applies the appropriate chat template. For Gemma models, uses the Gemma-specific format. For other models, falls back to 'apply_chat_template'.

Usage

smart_chat_template(model, messages, template = NULL,
  add_assistant = TRUE)

Arguments

model

A model object created with model_load

messages

A list of message objects

template

Custom template (passed to apply_chat_template if not Gemma)

add_assistant

Whether to add assistant turn prefix

Value

Formatted chat template string


localLLM documentation built on Nov. 3, 2026, 1:09 a.m.