fix common_chat_msg invocations

This commit is contained in:
Olivier Chafik 2025-01-22 16:25:51 +00:00
parent d186721e41
commit f0231a586e
2 changed files with 9 additions and 9 deletions

View file

@ -1855,10 +1855,10 @@ std::string common_chat_format_single(
std::string common_chat_format_example(const common_chat_template & tmpl, bool use_jinja) {
std::vector<common_chat_msg> msgs = {
{"system", "You are a helpful assistant"},
{"user", "Hello"},
{"assistant", "Hi there"},
{"user", "How are you?"},
{"system", "You are a helpful assistant", {}},
{"user", "Hello", {}},
{"assistant", "Hi there", {}},
{"user", "How are you?", {}},
};
return common_chat_apply_template(tmpl, msgs, true, use_jinja);
}

View file

@ -328,7 +328,7 @@ int main(void) {
// test llama_chat_format_single for system message
printf("\n\n=== llama_chat_format_single (system message) ===\n\n");
std::vector<common_chat_msg> chat2;
common_chat_msg sys_msg{"system", "You are a helpful assistant"};
common_chat_msg sys_msg{"system", "You are a helpful assistant", {}};
auto fmt_sys = [&](std::string tmpl_str) {
minja::chat_template tmpl(tmpl_str, "", "");
@ -352,10 +352,10 @@ int main(void) {
// test llama_chat_format_single for user message
printf("\n\n=== llama_chat_format_single (user message) ===\n\n");
chat2.push_back({"system", "You are a helpful assistant"});
chat2.push_back({"user", "Hello"});
chat2.push_back({"assistant", "I am assistant"});
common_chat_msg new_msg{"user", "How are you"};
chat2.push_back({"system", "You are a helpful assistant", {}});
chat2.push_back({"user", "Hello", {}});
chat2.push_back({"assistant", "I am assistant", {}});
common_chat_msg new_msg{"user", "How are you", {}};
auto fmt_single = [&](std::string tmpl_str) {
minja::chat_template tmpl(tmpl_str, "", "");