Function chat_templates::apply_template
source · pub fn apply_template(
template: ChatTemplate,
messages: &Vec<Message>,
add_generation_prompt: bool
) -> Result<String, ApplyTemplateError>Expand description
Apply chat template to messages, return the prompt
§Arguments
messages- a list of messages, each message containsroleandcontentadd_generation_prompt- iftrue, attach<|im_start|>assistant\nat the end of the prompttemplate- the jinja template