MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / common_chat_verify_template

Function common_chat_verify_template

common/chat.cpp:454–478  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

452}
453
454bool common_chat_verify_template(const std::string & tmpl, bool use_jinja) {
455 if (use_jinja) {
456 try {
457 common_chat_msg msg;
458 msg.role = "user";
459 msg.content = "test";
460
461 auto tmpls = common_chat_templates_init(/* model= */ nullptr, tmpl);
462
463 common_chat_templates_inputs inputs;
464 inputs.messages = { msg };
465
466 common_chat_templates_apply(tmpls.get(), inputs);
467 return true;
468 } catch (const std::exception & e) {
469 LOG_ERR("%s: failed to apply template: %s\n", __func__, e.what());
470 return false;
471 }
472 }
473 llama_chat_message chat[] = {
474 { "user", "test" }
475 };
476 const int res = llama_chat_apply_template(tmpl.c_str(), chat, 1, true, nullptr, 0);
477 return res >= 0;
478}
479
480std::string common_chat_format_single(const struct common_chat_templates * tmpls,
481 const std::vector<common_chat_msg> & past_msg,

Callers 1

common_params_parse_exFunction · 0.85

Calls 5

getMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected