1010from typing_extensions import Any
1111
1212from openai .pagination import SyncCursorPage
13- from openai .types .chat .chat_completion_function_tool_param import ChatCompletionFunctionToolParam
13+ from openai .types .chat .chat_completion_tool_param import ChatCompletionToolParam
1414from openai .types .chat .chat_completion_message import FunctionCall
1515from openai .types .responses import Response
1616from openai .types .responses .response_item import ResponseItem
17- from openai .types .chat .chat_completion_message_function_tool_call import (
18- ChatCompletionMessageFunctionToolCall ,
17+ from openai .types .chat .chat_completion_message_tool_call import (
18+ ChatCompletionMessageToolCall ,
1919 Function ,
2020)
2121from openai .types .responses .tool import Tool
@@ -114,11 +114,9 @@ def _create_evaluation_row(self, input_items: SyncCursorPage[ResponseItem], resp
114114 ),
115115 )
116116
117- def _responses_tools_to_chat_completion_tools (
118- self , tools : List [Tool ]
119- ) -> Sequence [ChatCompletionFunctionToolParam ]:
117+ def _responses_tools_to_chat_completion_tools (self , tools : List [Tool ]) -> Sequence [ChatCompletionToolParam ]:
120118 """Convert OpenAI Responses API tools to chat completion message function tool calls."""
121- chat_completion_tools : List [ChatCompletionFunctionToolParam ] = []
119+ chat_completion_tools : List [ChatCompletionToolParam ] = []
122120 for tool in tools :
123121 if tool .type == "function" :
124122 chat_completion_tools .append (
@@ -146,7 +144,7 @@ def _create_messages(self, input_items: SyncCursorPage[ResponseItem]) -> Iterabl
146144 be added before the assistant message with tool calls.
147145 """
148146 messages : list [Message ] = []
149- current_tool_calls : list [ChatCompletionMessageFunctionToolCall ] = []
147+ current_tool_calls : list [ChatCompletionMessageToolCall ] = []
150148 tool_call_outputs : list [Message ] = []
151149
152150 for item in input_items :
@@ -173,7 +171,7 @@ def _create_messages(self, input_items: SyncCursorPage[ResponseItem]) -> Iterabl
173171 # Collect tool call outputs to add before assistant message
174172 tool_call_outputs .append (Message (role = "tool" , content = item .output , tool_call_id = item .call_id ))
175173 elif item .type == "function_call" :
176- tool_call = ChatCompletionMessageFunctionToolCall (
174+ tool_call = ChatCompletionMessageToolCall (
177175 id = item .call_id , type = "function" , function = Function (name = item .name , arguments = item .arguments )
178176 )
179177 current_tool_calls .append (tool_call )
0 commit comments