{"record":{"id":"284db18d7129da1a","repo":"sgl-project/sglang","slug":"kimi-k3-uses-its-model-native-structural-tag-imple","errorCode":null,"errorMessage":"Kimi K3 uses its model-native structural tag implementation","messagePattern":"Kimi K3 uses its model-native structural tag implementation","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/function_call/kimik3_detector.py","lineNumber":89,"sourceCode":"    \"\"\"\n\n    def __init__(self):\n        super().__init__()\n        self.bot_token = TOOLS_OPEN\n        self.eot_token = TOOLS_CLOSE\n        self._sent_normal_idx = 0\n\n    def has_tool_call(self, text: str) -> bool:\n        return self.bot_token in text\n\n    def supports_structural_tag(self) -> bool:\n        return True\n\n    def parses_required_natively(self) -> bool:\n        return False\n\n    def structure_info(self) -> _GetInfoFunc:\n        raise NotImplementedError(\n            \"Kimi K3 uses its model-native structural tag implementation\"\n        )\n\n    def get_auto_tool_call_structural_tag(\n        self,\n        tools: Union[List[Tool], None] = None,\n        thinking_mode: bool = False,\n        parallel_tool_calls: bool = True,\n    ) -> Optional[StructuralTag]:\n        return get_kimik3_auto_tool_call_structural_tag(\n            tools or [],\n            thinking_mode=thinking_mode,\n            parallel_tool_calls=parallel_tool_calls,\n        )\n\n    def get_structural_tag(\n        self,\n        tools: Union[List[Tool], None] = None,","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/function_call/kimik3_detector.py#L71-L107","documentation":"KimiK3 detector's structure_info() is intentionally not implemented because Kimi K3 tool calls are enforced via model-native structural tags (get_auto_tool_call_structural_tag), not the generic StructureInfo constrained-generation path. Calling it is a misuse of this detector.","triggerScenarios":"Invoking structure_info() on the Kimi K3 detector, e.g. generic code that assumes all FunctionCallParser subclasses expose StructureInfo.","commonSituations":"Adding a new function-call feature that iterates parsers; mixing the KimiK3 parser with logic built for StructureInfo-based parsers.","solutions":["Use get_auto_tool_call_structural_tag(...) instead, which returns the structural tag format Kimi K3 actually uses","Skip KimiK3 when calling structure_info across parsers","Route JSON-schema constraints through the constraint backend directly"],"exampleFix":"// before\nfmt = detector.structure_info()\n// after\nfmt = detector.get_auto_tool_call_structural_tag(tools=tools)","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"def get_constraint_fn(detector):\n    if hasattr(detector, \"get_auto_tool_call_structural_tag\"):\n        return None  # use structural tags instead\n    return detector.structure_info()","tryCatchPattern":null,"preventionTips":["Prefer get_auto_tool_call_structural_tag for KimiK3","Never assume all detectors implement StructureInfo"],"tags":["kimi-k3","function-call","not-implemented","structural-tag"],"backgroundTag":"not-implemented-method-misuse","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}