Skip to content

Commit f2bc427

Browse files
committed
add warn
Signed-off-by: okada shintarou <[email protected]>
1 parent a6b5baf commit f2bc427

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

vllm/entrypoints/openai/serving_chat.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,23 @@ async def create_chat_completion(
175175
"--enable-auto-tool-choice and --tool-call-parser to be set"
176176
)
177177

178-
if (request.tools is None
179-
or (request.tool_choice == "none"
180-
and not self.expand_tools_even_if_tool_choice_none)):
178+
if request.tools is None:
179+
tool_dicts = None
180+
elif (request.tool_choice == "none"
181+
and not self.expand_tools_even_if_tool_choice_none):
182+
assert request.tools is not None
183+
if len(request.tools) > 0:
184+
logger.warning(
185+
"Tools are specified but tool_choice is set to 'none' and "
186+
"--expand-tools-even-if-tool-choice-none is not enabled. "
187+
"Tool definitions will be excluded from the prompt. "
188+
"This behavior will change in vLLM v0.10 where tool definitions "
189+
"will be included by default even with tool_choice='none'. "
190+
"To adopt the new behavior now, "
191+
"use --expand-tools-even-if-tool-choice-none. "
192+
"To suppress this warning, either remove tools from the request "
193+
"or set tool_choice to a different value."
194+
)
181195
tool_dicts = None
182196
else:
183197
tool_dicts = [tool.model_dump() for tool in request.tools]

0 commit comments

Comments
 (0)