Update examples/server/server.cpp
Co-authored-by: Xuan-Son Nguyen <thichthat@gmail.com> Signed-off-by: Eric Curtin <ecurtin@redhat.com>
This commit is contained in:
parent
a4e9e4d41b
commit
e00c9d1c5e
1 changed files with 6 additions and 6 deletions
|
@ -1899,10 +1899,10 @@ struct server_context {
|
||||||
auto templates = common_chat_templates_from_model(model, "");
|
auto templates = common_chat_templates_from_model(model, "");
|
||||||
common_chat_inputs inputs;
|
common_chat_inputs inputs;
|
||||||
inputs.messages = json::array({
|
inputs.messages = json::array({
|
||||||
{
|
{
|
||||||
{ "role", "user" },
|
{ "role", "user" },
|
||||||
{ "content", "test" },
|
{ "content", "test" },
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
GGML_ASSERT(templates.template_default);
|
GGML_ASSERT(templates.template_default);
|
||||||
try {
|
try {
|
||||||
|
@ -1925,12 +1925,12 @@ struct server_context {
|
||||||
};
|
};
|
||||||
|
|
||||||
if (use_jinja) {
|
if (use_jinja) {
|
||||||
return apply_jinja_templates();
|
return validate_jinja_templates();
|
||||||
} else {
|
} else {
|
||||||
const char * tmpl = llama_model_chat_template(model, /* name */ nullptr);
|
const char * tmpl = llama_model_chat_template(model, /* name */ nullptr);
|
||||||
const int32_t chat_res = llama_chat_apply_template(tmpl, chat, 1, true, nullptr, 0);
|
const int32_t chat_res = llama_chat_apply_template(tmpl, chat, 1, true, nullptr, 0);
|
||||||
if (chat_res < 0) {
|
if (chat_res < 0) {
|
||||||
return apply_jinja_templates();
|
return validate_jinja_templates();
|
||||||
}
|
}
|
||||||
|
|
||||||
return chat_res > 0;
|
return chat_res > 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue