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

Function main

scripts/server-test-structured.py:929–976  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

927
928
929def main():
930 parser = argparse.ArgumentParser(
931 description="Test llama-server structured-output capability."
932 )
933 parser.add_argument("--host", default="localhost")
934 parser.add_argument("--port", default=8080, type=int)
935 parser.add_argument(
936 "--no-stream", action="store_true", help="Disable streaming mode tests"
937 )
938 parser.add_argument(
939 "--stream-only", action="store_true", help="Only run streaming mode tests"
940 )
941 parser.add_argument(
942 "--test",
943 help="Run only the test whose name contains this substring (case-insensitive)",
944 )
945 args = parser.parse_args()
946
947 url = f"http://{args.host}:{args.port}/v1/chat/completions"
948 print_info(f"Testing server at {url}")
949
950 modes: list[bool] = []
951 if not args.stream_only:
952 modes.append(False)
953 if not args.no_stream:
954 modes.append(True)
955
956 cases: list[dict] = ALL_TEST_CASES
957 if args.test:
958 name_filter = args.test.lower()
959 cases = [c for c in cases if name_filter in str(c["name"]).lower()]
960 if not cases:
961 print_fail(f"No test cases matched '{args.test}'")
962 sys.exit(1)
963
964 total = 0
965 passed = 0
966 for stream in modes:
967 for case in cases:
968 total += 1
969 if run_test(url, case, stream=stream):
970 passed += 1
971
972 color = GREEN if passed == total else RED
973 _print(f"\n{BOLD}{color}{'─' * 60}{RESET}")
974 _print(f"{BOLD}{color} Results: {passed}/{total} passed{RESET}")
975 _print(f"{BOLD}{color}{'─' * 60}{RESET}\n")
976 sys.exit(0 if passed == total else 1)
977
978
979if __name__ == "__main__":

Callers 1

Calls 6

parse_argsMethod · 0.80
print_infoFunction · 0.70
print_failFunction · 0.70
run_testFunction · 0.70
_printFunction · 0.70
appendMethod · 0.45

Tested by

no test coverage detected