Skip to content

Commit e59d75a

Browse files
committed
[Frontend] OpenAI Responses API supports Tool/Function calling
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
1 parent 11dd5cf commit e59d75a

File tree

2 files changed

+2
-23
lines changed

2 files changed

+2
-23
lines changed

vllm/entrypoints/openai/serving_chat.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,6 @@ def __init__(
8585
self.tool_parser = self._get_tool_parser(
8686
tool_parser_name=tool_parser, enable_auto_tools=enable_auto_tools)
8787

88-
self.expand_tools_even_if_tool_choice_none = (
89-
expand_tools_even_if_tool_choice_none)
90-
9188
self.enable_prompt_tokens_details = enable_prompt_tokens_details
9289
self.enable_force_include_usage = enable_force_include_usage
9390
self.default_sampling_params = (

vllm/entrypoints/openai/serving_responses.py

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ def __init__(
7373
enable_force_include_usage=enable_force_include_usage,
7474
)
7575
self.enable_auto_tools = enable_auto_tools
76-
self.expand_tools_even_if_tool_choice_none = (
77-
expand_tools_even_if_tool_choice_none)
7876
self.chat_template = chat_template
7977
self.chat_template_content_format: Final = chat_template_content_format
8078

@@ -145,20 +143,6 @@ async def create_responses(
145143
tokenizer = await self.engine_client.get_tokenizer(lora_request)
146144
if request.tools is None:
147145
tool_dicts = None
148-
elif (request.tool_choice == "none"
149-
and not self.expand_tools_even_if_tool_choice_none):
150-
if len(request.tools) > 0:
151-
logger.warning_once(
152-
"Tools are specified but tool_choice is set to 'none' "
153-
"and --expand-tools-even-if-tool-choice-none is not "
154-
"enabled. Tool definitions will be excluded from the "
155-
"prompt. This behavior will change in vLLM v0.10 where "
156-
"tool definitions will be included by default even "
157-
"with tool_choice='none'. To adopt the new behavior "
158-
"now, use --expand-tools-even-if-tool-choice-none. "
159-
"To suppress this warning, either remove tools from "
160-
"the request or set tool_choice to a different value.")
161-
tool_dicts = None
162146
else:
163147
tool_dicts = [tool.model_dump() for tool in request.tools]
164148
_, request_prompts, engine_prompts = await self._preprocess_chat(
@@ -331,15 +315,13 @@ async def responses_full_generator(
331315
)
332316
outputs = []
333317
function_calls: list[FunctionCall] = []
334-
if (not self.enable_auto_tools or not self.tool_parser):
318+
if not self.enable_auto_tools or not self.tool_parser:
335319
# Tools are not enabled
336320
if reasoning_item:
337321
outputs.append(reasoning_item)
338322
if message_item:
339323
outputs.append(message_item)
340-
elif (request.tool_choice == "none" and \
341-
not self.expand_tools_even_if_tool_choice_none) or \
342-
request.tool_choice is None:
324+
elif request.tool_choice is None:
343325
# No tool calls.
344326
if reasoning_item:
345327
outputs.append(reasoning_item)

0 commit comments

Comments
 (0)