View source: R/gemma_chat_template.R
| apply_gemma_chat_template | R Documentation |
Creates a properly formatted chat template for Gemma models, which use <start_of_turn> and <end_of_turn> markers instead of ChatML format. This function addresses compatibility issues with apply_chat_template() when used with Gemma models.
apply_gemma_chat_template(messages, add_assistant = TRUE)
messages |
A list of message objects, each with 'role' and 'content' fields |
add_assistant |
Whether to add the assistant turn prefix (default: TRUE) |
A character string with properly formatted Gemma chat template
## Not run:
messages <- list(
list(role = "system", content = "You are a helpful assistant."),
list(role = "user", content = "Hello!")
)
formatted <- apply_gemma_chat_template(messages)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.