-
Notifications
You must be signed in to change notification settings - Fork 16
fix external import error #211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,12 +10,12 @@ | |
| from typing_extensions import Any | ||
|
|
||
| from openai.pagination import SyncCursorPage | ||
| from openai.types.chat.chat_completion_function_tool_param import ChatCompletionFunctionToolParam | ||
| from openai.types.chat.chat_completion_tool_param import ChatCompletionToolParam | ||
| from openai.types.chat.chat_completion_message import FunctionCall | ||
| from openai.types.responses import Response | ||
| from openai.types.responses.response_item import ResponseItem | ||
| from openai.types.chat.chat_completion_message_function_tool_call import ( | ||
| ChatCompletionMessageFunctionToolCall, | ||
| from openai.types.chat.chat_completion_message_tool_call import ( | ||
| ChatCompletionMessageToolCall, | ||
| Function, | ||
| ) | ||
| from openai.types.responses.tool import Tool | ||
|
|
@@ -114,11 +114,9 @@ def _create_evaluation_row(self, input_items: SyncCursorPage[ResponseItem], resp | |
| ), | ||
| ) | ||
|
|
||
| def _responses_tools_to_chat_completion_tools( | ||
| self, tools: List[Tool] | ||
| ) -> Sequence[ChatCompletionFunctionToolParam]: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry, what is this change? was it incorrect before?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think its a version issue, i tested in a clean env (0 previous installed dependencies in it) and it complained on this import. |
||
| def _responses_tools_to_chat_completion_tools(self, tools: List[Tool]) -> Sequence[ChatCompletionToolParam]: | ||
| """Convert OpenAI Responses API tools to chat completion message function tool calls.""" | ||
| chat_completion_tools: List[ChatCompletionFunctionToolParam] = [] | ||
| chat_completion_tools: List[ChatCompletionToolParam] = [] | ||
| for tool in tools: | ||
| if tool.type == "function": | ||
| chat_completion_tools.append( | ||
|
|
@@ -146,7 +144,7 @@ def _create_messages(self, input_items: SyncCursorPage[ResponseItem]) -> Iterabl | |
| be added before the assistant message with tool calls. | ||
| """ | ||
| messages: list[Message] = [] | ||
| current_tool_calls: list[ChatCompletionMessageFunctionToolCall] = [] | ||
| current_tool_calls: list[ChatCompletionMessageToolCall] = [] | ||
| tool_call_outputs: list[Message] = [] | ||
|
|
||
| for item in input_items: | ||
|
|
@@ -173,7 +171,7 @@ def _create_messages(self, input_items: SyncCursorPage[ResponseItem]) -> Iterabl | |
| # Collect tool call outputs to add before assistant message | ||
| tool_call_outputs.append(Message(role="tool", content=item.output, tool_call_id=item.call_id)) | ||
| elif item.type == "function_call": | ||
| tool_call = ChatCompletionMessageFunctionToolCall( | ||
| tool_call = ChatCompletionMessageToolCall( | ||
| id=item.call_id, type="function", function=Function(name=item.name, arguments=item.arguments) | ||
| ) | ||
| current_tool_calls.append(tool_call) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you!