mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2026-05-11 01:31:25 +08:00
fix: kimi_k2 return empty tool call list (#22149)
Signed-off-by: tlipoca9 <tlipoca9@gmail.com>
This commit is contained in:
parent
d7b28f3415
commit
8a6e108e76
@ -38,15 +38,15 @@ class KimiK2ToolParser(ToolParser):
|
|||||||
self.tool_call_end_token: str = "<|tool_call_end|>"
|
self.tool_call_end_token: str = "<|tool_call_end|>"
|
||||||
|
|
||||||
self.tool_call_regex = re.compile(
|
self.tool_call_regex = re.compile(
|
||||||
r"<\|tool_call_begin\|>\s*(?P<tool_call_id>[\w\.]+:\d+)\s*<\|tool_call_argument_begin\|>\s*(?P<function_arguments>.*?)\s*<\|tool_call_end\|>"
|
r"<\|tool_call_begin\|>\s*(?P<tool_call_id>.+:\d+)\s*<\|tool_call_argument_begin\|>\s*(?P<function_arguments>.*?)\s*<\|tool_call_end\|>"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.stream_tool_call_portion_regex = re.compile(
|
self.stream_tool_call_portion_regex = re.compile(
|
||||||
r"(?P<tool_call_id>[\w\.]+:\d+)\s*<\|tool_call_argument_begin\|>\s*(?P<function_arguments>.*)"
|
r"(?P<tool_call_id>.+:\d+)\s*<\|tool_call_argument_begin\|>\s*(?P<function_arguments>.*)"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.stream_tool_call_name_regex = re.compile(
|
self.stream_tool_call_name_regex = re.compile(
|
||||||
r"(?P<tool_call_id>[\w\.]+:\d+)\s*")
|
r"(?P<tool_call_id>.+:\d+)\s*")
|
||||||
|
|
||||||
if not self.model_tokenizer:
|
if not self.model_tokenizer:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user