Skip to content

Commit 1ab9c9d

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

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

vllm/entrypoints/openai/protocol.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ def get_logits_processors(
297297
def get_json_schema_from_tool(
298298
tool_choice: str | ToolChoice | ChatCompletionNamedToolChoiceParam,
299299
tools: list[Tool | ChatCompletionToolsParam] | None,
300-
) -> str | dict | BaseModel | None:
300+
) -> str | dict | None:
301301
if tool_choice in ("none", None) or tools is None:
302302
return None
303303
if (not isinstance(tool_choice, str)) and isinstance(tool_choice, ToolChoice):

vllm/entrypoints/openai/serving_responses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def __init__(
190190
self.default_sampling_params["stop_token_ids"].extend(
191191
get_stop_tokens_for_assistant_actions()
192192
)
193-
193+
self.enable_auto_tools = enable_auto_tools
194194
# set up tool use
195195
self.tool_parser = self._get_tool_parser(
196196
tool_parser_name=tool_parser, enable_auto_tools=enable_auto_tools

vllm/entrypoints/openai/tool_parsers/abstract_tool_parser.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
ChatCompletionRequest,
1010
DeltaMessage,
1111
ExtractedToolCallInformation,
12+
ResponsesRequest,
1213
)
1314
from vllm.logger import init_logger
1415
from vllm.transformers_utils.tokenizer import AnyTokenizer
@@ -46,7 +47,7 @@ def adjust_request(self, request: ChatCompletionRequest) -> ChatCompletionReques
4647
return request
4748

4849
def extract_tool_calls(
49-
self, model_output: str, request: ChatCompletionRequest
50+
self, model_output: str, request: ChatCompletionRequest | ResponsesRequest
5051
) -> ExtractedToolCallInformation:
5152
"""
5253
Static method that should be implemented for extracting tool calls from

0 commit comments

Comments
 (0)