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

Function foreach_function

smallthinker/common/chat.cpp:711–719  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

709}
710
711static void foreach_function(const json & tools, const std::function<void(const json &)> & fn) {
712 for (const auto & tool : tools) {
713 if (!tool.contains("type") || tool.at("type") != "function" || !tool.contains("function")) {
714 LOG_INF("Skipping tool without function: %s", tool.dump(2).c_str());
715 continue;
716 }
717 fn(tool);
718 }
719}
720
721static std::string apply(
722 const common_chat_template & tmpl,

Calls 3

dumpMethod · 0.80
fnFunction · 0.50
c_strMethod · 0.45

Tested by

no test coverage detected