MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / common_chat_format_example

Function common_chat_format_example

smallthinker/common/chat.cpp:466–480  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

464}
465
466std::string common_chat_format_example(const struct common_chat_templates * tmpls, bool use_jinja) {
467 common_chat_templates_inputs inputs;
468 inputs.use_jinja = use_jinja;
469 auto add_simple_msg = [&](auto role, auto content) {
470 common_chat_msg msg;
471 msg.role = role;
472 msg.content = content;
473 inputs.messages.push_back(msg);
474 };
475 add_simple_msg("system", "You are a helpful assistant");
476 add_simple_msg("user", "Hello");
477 add_simple_msg("assistant", "Hi there");
478 add_simple_msg("user", "How are you?");
479 return common_chat_templates_apply(tmpls, inputs).prompt;
480}
481
482#define CHATML_TEMPLATE_SRC \
483 "{%- for message in messages -%}\n" \

Callers 4

mtmd_cli_contextMethod · 0.85
mainFunction · 0.85
load_modelMethod · 0.85
mainFunction · 0.85

Calls 2

push_backMethod · 0.45

Tested by

no test coverage detected