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

Function main

smallthinker/tests/test-chat.cpp:1430–1474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1428}
1429
1430int main(int argc, char ** argv) {
1431 // try {
1432#ifndef _WIN32
1433 if (argc > 1) {
1434 common_chat_templates_inputs inputs;
1435 common_chat_msg msg;
1436 msg.role = "user";
1437 msg.content = "Hey";
1438 inputs.messages = {msg};
1439 inputs.tools = { special_function_tool };
1440
1441 std::cout << "| Template | Format |\n";
1442 std::cout << "|----------|--------|\n";
1443
1444 for (int i = 1; i < argc; i++) {
1445 try {
1446 std::string path = argv[i];
1447 if (path.rfind(".jinja") != path.size() - 6) {
1448 std::cerr << "Skipping non-jinja file: " << path << '\n';
1449 continue;
1450 }
1451 auto tmpls = read_templates(path);
1452 auto parts = string_split(path, "/");
1453 auto name = parts[parts.size() - 1];
1454 auto format = common_chat_format_name(common_chat_templates_apply(tmpls.get(), inputs).format);
1455 std::cout << "| " << name << " | " << format << " |\n";
1456 } catch (const std::exception & e) {
1457 std::cerr << "Failed to process " << argv[i] << ": " << e.what() << '\n';
1458 }
1459 }
1460 } else
1461#endif
1462 {
1463 test_msg_diffs_compute();
1464 test_msgs_oaicompat_json_conversion();
1465 test_tools_oaicompat_json_conversion();
1466 test_template_output_parsers();
1467 std::cout << "\n[chat] All tests passed!" << '\n';
1468 }
1469 return 0;
1470 // } catch (const std::exception & e) {
1471 // std::cerr << "Error: " << e.what() << '\n';
1472 // return 1;
1473 // }
1474}

Callers

nothing calls this directly

Calls 11

read_templatesFunction · 0.85
common_chat_format_nameFunction · 0.85
test_msg_diffs_computeFunction · 0.85
string_splitFunction · 0.50
sizeMethod · 0.45
getMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected