Unverified Commit 43813e63 authored by Reid's avatar Reid Committed by GitHub
Browse files

[Misc] call the pre-defined func (#20518)


Signed-off-by: default avatarreidliu41 <reid201711@gmail.com>
parent cede942b
...@@ -6,6 +6,7 @@ from typing import Union ...@@ -6,6 +6,7 @@ from typing import Union
import regex as re import regex as re
from vllm.entrypoints.chat_utils import random_tool_call_id
from vllm.entrypoints.openai.protocol import (ChatCompletionRequest, from vllm.entrypoints.openai.protocol import (ChatCompletionRequest,
DeltaFunctionCall, DeltaMessage, DeltaFunctionCall, DeltaMessage,
DeltaToolCall, DeltaToolCall,
...@@ -15,7 +16,6 @@ from vllm.entrypoints.openai.tool_parsers.abstract_tool_parser import ( ...@@ -15,7 +16,6 @@ from vllm.entrypoints.openai.tool_parsers.abstract_tool_parser import (
ToolParser, ToolParserManager) ToolParser, ToolParserManager)
from vllm.logger import init_logger from vllm.logger import init_logger
from vllm.transformers_utils.tokenizer import AnyTokenizer from vllm.transformers_utils.tokenizer import AnyTokenizer
from vllm.utils import random_uuid
logger = init_logger(__name__) logger = init_logger(__name__)
...@@ -267,7 +267,7 @@ class DeepSeekV3ToolParser(ToolParser): ...@@ -267,7 +267,7 @@ class DeepSeekV3ToolParser(ToolParser):
DeltaToolCall( DeltaToolCall(
index=self.current_tool_id, index=self.current_tool_id,
type="function", type="function",
id=f"chatcmpl-tool-{random_uuid()}", id=random_tool_call_id(),
function=DeltaFunctionCall( function=DeltaFunctionCall(
name=function_name).model_dump( name=function_name).model_dump(
exclude_none=True), exclude_none=True),
......
...@@ -7,6 +7,7 @@ from typing import Any, Optional, Union ...@@ -7,6 +7,7 @@ from typing import Any, Optional, Union
import regex as re import regex as re
from vllm.entrypoints.chat_utils import random_tool_call_id
from vllm.entrypoints.openai.protocol import (ChatCompletionRequest, from vllm.entrypoints.openai.protocol import (ChatCompletionRequest,
DeltaFunctionCall, DeltaMessage, DeltaFunctionCall, DeltaMessage,
DeltaToolCall, DeltaToolCall,
...@@ -225,7 +226,7 @@ class xLAMToolParser(ToolParser): ...@@ -225,7 +226,7 @@ class xLAMToolParser(ToolParser):
function_name = name_match.group(1) function_name = name_match.group(1)
# The test expects us to send just the name first # The test expects us to send just the name first
tool_id = f"chatcmpl-tool-{random_uuid()}" tool_id = random_tool_call_id()
delta = DeltaMessage(tool_calls=[ delta = DeltaMessage(tool_calls=[
DeltaToolCall( DeltaToolCall(
index=0, index=0,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment