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 contains role and content
  • add_generation_prompt - if true, attach <|im_start|>assistant\n at the end of the prompt
  • template - the jinja template