safer jinja llama_chat_templates struct

This commit is contained in:
Xuan Son Nguyen
2025-01-20 16:58:29 +01:00
parent cc50356470
commit c9e7cbb08b
3 changed files with 17 additions and 14 deletions

View File

@@ -1855,13 +1855,12 @@ llama_chat_templates llama_chat_templates_from_model(const struct llama_model *
)";
}
}
return {
has_explicit_template,
std::make_unique<minja::chat_template>(default_template_src, bos_token, eos_token),
tool_use_template_src.empty()
? nullptr
: std::make_unique<minja::chat_template>(tool_use_template_src, bos_token, eos_token)
};
llama_chat_templates ret(default_template_src, bos_token, eos_token);
ret.has_explicit_template = has_explicit_template;
ret.tool_use_template.reset(tool_use_template_src.empty()
? nullptr
: new minja::chat_template(tool_use_template_src, bos_token, eos_token));
return ret;
}
//