[Perf] Fork-safe import: no CUDA context at import time, lighter argument parsing (#40201)

This commit is contained in:
Xueshen Liu
2026-09-21 10:48:35 +08:00
committed by GitHub
parent 176dbcb85d
commit ab03a8e7eb
11 changed files with 381 additions and 12 deletions
@@ -34,6 +34,7 @@ from sglang.srt.function_call.lfm2_detector import Lfm2Detector
from sglang.srt.function_call.ling3_detector import Ling3Detector
from sglang.srt.function_call.llama32_detector import Llama32Detector
from sglang.srt.function_call.mistral_detector import MistralDetector
from sglang.srt.function_call.parser_names import TOOL_CALL_PARSER_NAMES
from sglang.srt.function_call.pythonic_detector import PythonicDetector
from sglang.srt.function_call.qwen3_coder_detector import Qwen3CoderDetector
from sglang.srt.function_call.utils import get_schema_properties
@@ -6013,5 +6014,15 @@ class TestTopLevelCompositeToolSchema(unittest.TestCase):
self.assertEqual(json.loads(arguments), self.expected)
class TestToolCallParserNames(unittest.TestCase):
def test_matches_registry(self):
# `server_args` builds the --tool-call-parser choices from this list to
# keep the registry, and its dependencies, out of argument parsing.
self.assertEqual(
sorted(TOOL_CALL_PARSER_NAMES),
sorted(FunctionCallParser.ToolCallParserEnum),
)
if __name__ == "__main__":
unittest.main()