@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 8a6e108e76
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 14, 05:30 UTC

fix: kimi_k2 return empty tool call list (#22149)

Signed-off-by: tlipoca9 <tlipoca9@gmail.com>

tlipoca9 committed Aug 5, 2025 at 10:15 UTC 8a6e108e76aed89ea23c345bd8fc46d904911e7c
1 file changed +4 -4
vllm/entrypoints/openai/tool_parsers/kimi_k2_tool_parser.py
+4 -4
@@ -38,15 +38,15 @@ class KimiK2ToolParser(ToolParser):
38 self.tool_call_end_token: str = "<|tool_call_end|>"
39
40 self.tool_call_regex = re.compile(
41 - r"<\|tool_call_begin\|>\s*(?P<tool_call_id>[\w\.]+:\d+)\s*<\|tool_call_argument_begin\|>\s*(?P<function_arguments>.*?)\s*<\|tool_call_end\|>"
41 + r"<\|tool_call_begin\|>\s*(?P<tool_call_id>.+:\d+)\s*<\|tool_call_argument_begin\|>\s*(?P<function_arguments>.*?)\s*<\|tool_call_end\|>"
42 )
43
44 self.stream_tool_call_portion_regex = re.compile(
45 - r"(?P<tool_call_id>[\w\.]+:\d+)\s*<\|tool_call_argument_begin\|>\s*(?P<function_arguments>.*)"
45 + r"(?P<tool_call_id>.+:\d+)\s*<\|tool_call_argument_begin\|>\s*(?P<function_arguments>.*)"
46 )
47
48 self.stream_tool_call_name_regex = re.compile(
49 - r"(?P<tool_call_id>[\w\.]+:\d+)\s*")
49 + r"(?P<tool_call_id>.+:\d+)\s*")
50
51 if not self.model_tokenizer:
52 raise ValueError(
@@ -374,4 +374,4 @@ class KimiK2ToolParser(ToolParser):
374
375 except Exception:
376 logger.exception("Error trying to handle streaming tool call.")
377 - return None # do not stream a delta. skip this token ID.
\ No newline at end of file
377 + return None # do not stream a delta. skip this token ID.