[Tool Parser][2/3] Use self.tools instead of request.tools in tool parsers (#38189)
Signed-off-by: sfeng33 <4florafeng@gmail.com>
This commit is contained in:
@@ -10,9 +10,11 @@ from openai.types.responses import (
|
||||
ResponseFormatTextJSONSchemaConfig,
|
||||
ResponseTextConfig,
|
||||
)
|
||||
from openai.types.responses.function_tool import FunctionTool
|
||||
|
||||
from vllm.entrypoints.openai.chat_completion.protocol import (
|
||||
ChatCompletionRequest,
|
||||
ChatCompletionToolsParam,
|
||||
)
|
||||
from vllm.entrypoints.openai.engine.protocol import (
|
||||
DeltaMessage,
|
||||
@@ -54,7 +56,14 @@ class ToolParser:
|
||||
self.streamed_args_for_tool: list[str] = []
|
||||
|
||||
self.model_tokenizer = tokenizer
|
||||
self.tools = tools
|
||||
if tools:
|
||||
self.tools: list[ChatCompletionToolsParam | FunctionTool] = [
|
||||
tool
|
||||
for tool in tools
|
||||
if isinstance(tool, (ChatCompletionToolsParam, FunctionTool))
|
||||
]
|
||||
else:
|
||||
self.tools = []
|
||||
|
||||
@cached_property
|
||||
def vocab(self) -> dict[str, int]:
|
||||
|
||||
Reference in New Issue
Block a user