Skip to content

Fix TypeError when instantiating ChatCompletionMessageToolCallParam due to typing.Union #1419

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

Closed

Conversation

Mazz-Ather
Copy link

This fixes the error "TypeError: Cannot instantiate typing.Union" that happens in recent openai-python versions (e.g., 1.99.3+). The param type is a Union, so it can't be created directly. Changed to use a dict, which works with the API.

Tested with my own agent code that was failing—now it runs fine without downgrading openai.

Related to openai/openai-python issues like #2529 or #2541 (if they exist; I couldn't find exact matches, but similar problems reported).

Thanks!

@seratch
Copy link
Member

seratch commented Aug 11, 2025

Thanks for sending this, but we'll resolve this by #1415

@seratch seratch closed this Aug 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants