Skip to content

Commit 7c9e8ce

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

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

@@ -142,20 +140,6 @@ async def create_responses(
142140
tokenizer = await self.engine_client.get_tokenizer(lora_request)
143141
if request.tools is None:
144142
tool_dicts = None
145-
elif (request.tool_choice == "none"
146-
and not self.expand_tools_even_if_tool_choice_none):
147-
if len(request.tools) > 0:
148-
logger.warning_once(
149-
"Tools are specified but tool_choice is set to 'none' "
150-
"and --expand-tools-even-if-tool-choice-none is not "
151-
"enabled. Tool definitions will be excluded from the "
152-
"prompt. This behavior will change in vLLM v0.10 where "
153-
"tool definitions will be included by default even "
154-
"with tool_choice='none'. To adopt the new behavior "
155-
"now, use --expand-tools-even-if-tool-choice-none. "
156-
"To suppress this warning, either remove tools from "
157-
"the request or set tool_choice to a different value.")
158-
tool_dicts = None
159143
else:
160144
tool_dicts = [tool.model_dump() for tool in request.tools]
161145
_, request_prompts, engine_prompts = await self._preprocess_chat(
@@ -326,15 +310,13 @@ async def responses_full_generator(
326310
)
327311
outputs = []
328312
function_calls: list[FunctionCall] = []
329-
if (not self.enable_auto_tools or not self.tool_parser):
313+
if not self.enable_auto_tools or not self.tool_parser:
330314
# Tools are not enabled
331315
if reasoning_item:
332316
outputs.append(reasoning_item)
333317
if message_item:
334318
outputs.append(message_item)
335-
elif (request.tool_choice == "none" and \
336-
not self.expand_tools_even_if_tool_choice_none) or \
337-
request.tool_choice is None:
319+
elif request.tool_choice is None:
338320
# No tool calls.
339321
if reasoning_item:
340322
outputs.append(reasoning_item)

0 commit comments

Comments
 (0)