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

Function common_chat_params_init_without_tools

smallthinker/common/chat.cpp:1692–1706  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1690}
1691
1692static common_chat_params common_chat_params_init_without_tools(const common_chat_template & tmpl, const struct templates_params & inputs) {
1693 common_chat_params data;
1694 data.prompt = apply(tmpl, inputs.messages, inputs.tools.empty() ? json() : inputs.tools, inputs.add_generation_prompt);
1695 data.format = COMMON_CHAT_FORMAT_CONTENT_ONLY;
1696 data.grammar_lazy = false;
1697 if (!inputs.json_schema.is_null()) {
1698 if (!inputs.grammar.empty()) {
1699 throw std::runtime_error("Either \"json_schema\" or \"grammar\" can be specified, but not both");
1700 }
1701 data.grammar = json_schema_to_grammar(inputs.json_schema);
1702 } else {
1703 data.grammar = inputs.grammar;
1704 }
1705 return data;
1706}
1707
1708static common_chat_params common_chat_templates_apply_jinja(
1709 const struct common_chat_templates * tmpls,

Callers 1

Calls 3

applyFunction · 0.85
json_schema_to_grammarFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected