Skip to content

Commit

Permalink
Update examples/server/server.cpp
Browse files Browse the repository at this point in the history
Co-authored-by: Xuan-Son Nguyen <[email protected]>
Signed-off-by: Eric Curtin <[email protected]>
  • Loading branch information
ericcurtin and ngxson committed Feb 6, 2025
1 parent a4e9e4d commit e00c9d1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions examples/server/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1899,10 +1899,10 @@ struct server_context {
auto templates = common_chat_templates_from_model(model, "");
common_chat_inputs inputs;
inputs.messages = json::array({
{
{ "role", "user" },
{ "content", "test" },
}
{
{ "role", "user" },
{ "content", "test" },
}
});
GGML_ASSERT(templates.template_default);
try {
Expand All @@ -1925,12 +1925,12 @@ struct server_context {
};

if (use_jinja) {
return apply_jinja_templates();
return validate_jinja_templates();
} else {
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);
if (chat_res < 0) {
return apply_jinja_templates();
return validate_jinja_templates();
}

return chat_res > 0;
Expand Down

0 comments on commit e00c9d1

Please sign in to comment.