Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

release: 1.76.0 #2316

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

Merged
merged 12 commits into from
Apr 23, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(pydantic v1): more robust ModelField.annotation check (#2163)
---------

Co-authored-by: Konnor Young <konnoryoung@ip-192-168-1-39.us-west-1.compute.internal>
Co-authored-by: Robert Craigie <robert@craigie.dev>
  • Loading branch information
3 people authored Apr 22, 2025
commit 7351b12bc981f56632b92342d9ef26f6fb28d540
4 changes: 2 additions & 2 deletions 4 src/openai/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,8 +651,8 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any,
# Note: if one variant defines an alias then they all should
discriminator_alias = field_info.alias

if field_info.annotation and is_literal_type(field_info.annotation):
for entry in get_args(field_info.annotation):
if (annotation := getattr(field_info, 'annotation', None)) and is_literal_type(annotation):
for entry in get_args(annotation):
if isinstance(entry, str):
mapping[entry] = variant

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.