Skip to content

Fix #968 by upgrading openai package to the latest #1034

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

seratch
Copy link
Member

@seratch seratch commented Jul 8, 2025

This pull request resolves #968

@seratch
Copy link
Member Author

seratch commented Jul 8, 2025

Will fix this too:

uv run mypy .
src/agents/models/openai_responses.py:33[8](https://github.com/openai/openai-agents-python/actions/runs/16141563102/job/45550038949#step:5:9): error: Incompatible types (expression has type "Literal['mcp']", TypedDict item "type" has type "Literal['file_search', 'web_search_preview', 'computer_use_preview', 'web_search_preview_2025_03_11', 'image_generation', 'code_interpreter']")  [typeddict-item]
Found 1 error in 1 file (checked 235 source files)
make: *** [Makefile:16: mypy] Error 1
Error: Process completed with exit code 2.

@@ -303,10 +303,19 @@ class ConvertedTools:
class Converter:
@classmethod
def convert_tool_choice(
cls, tool_choice: Literal["auto", "required", "none"] | str | None
cls, tool_choice: Literal["auto", "required", "none"] | str | dict[str, Any] | None
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the dictionary parameter is not yet used, but for future enhancement

@@ -335,6 +344,7 @@ def convert_tool_choice(
}
elif tool_choice == "mcp":
return {
"server_label": "mcp",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not correct, but just for backward and type compat

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like it could be a breaking change (you used to set tool choice to mcp, now the server will error because the server with label mcp doesnt exist)

can we do something smarter here?

Copy link
Collaborator

@rm-openai rm-openai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quick q

@@ -335,6 +344,7 @@ def convert_tool_choice(
}
elif tool_choice == "mcp":
return {
"server_label": "mcp",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like it could be a breaking change (you used to set tool choice to mcp, now the server will error because the server with label mcp doesnt exist)

can we do something smarter here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature:core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pydantic_core._pydantic_core.ValidationError: 1 validation error for ResponseFunctionWebSearch action
2 participants