Skip to content

Commit 369d10a

Browse files
chore(internal): update pydantic dependency
1 parent 0b4bc50 commit 369d10a

File tree

3 files changed

+24
-11
lines changed

3 files changed

+24
-11
lines changed

requirements-dev.lock

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ multidict==6.5.0
108108
mypy==1.14.1
109109
mypy-extensions==1.0.0
110110
# via mypy
111+
nest-asyncio==1.6.0
111112
nodeenv==1.8.0
112113
# via pyright
113114
nox==2023.4.22
@@ -133,11 +134,11 @@ portalocker==2.10.1
133134
propcache==0.3.2
134135
# via aiohttp
135136
# via yarl
136-
pycparser==2.22
137+
pycparser==2.23
137138
# via cffi
138-
pydantic==2.10.3
139+
pydantic==2.11.9
139140
# via openai
140-
pydantic-core==2.27.1
141+
pydantic-core==2.33.2
141142
# via pydantic
142143
pygments==2.18.0
143144
# via pytest
@@ -199,6 +200,9 @@ typing-extensions==4.12.2
199200
# via pydantic
200201
# via pydantic-core
201202
# via pyright
203+
# via typing-inspection
204+
typing-inspection==0.4.1
205+
# via pydantic
202206
tzdata==2024.1
203207
# via pandas
204208
urllib3==2.2.1

requirements.lock

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ pandas-stubs==2.2.2.240807
6767
propcache==0.3.2
6868
# via aiohttp
6969
# via yarl
70-
pycparser==2.22
70+
pycparser==2.23
7171
# via cffi
72-
pydantic==2.10.3
72+
pydantic==2.11.9
7373
# via openai
74-
pydantic-core==2.27.1
74+
pydantic-core==2.33.2
7575
# via pydantic
7676
python-dateutil==2.9.0.post0
7777
# via pandas
@@ -93,7 +93,10 @@ typing-extensions==4.12.2
9393
# via openai
9494
# via pydantic
9595
# via pydantic-core
96-
tzdata==2024.1
96+
# via typing-inspection
97+
typing-inspection==0.4.1
98+
# via pydantic
99+
tzdata==2025.2
97100
# via pandas
98101
websockets==15.0.1
99102
# via openai

src/openai/_models.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,14 +281,15 @@ def model_dump(
281281
mode: Literal["json", "python"] | str = "python",
282282
include: IncEx | None = None,
283283
exclude: IncEx | None = None,
284-
by_alias: bool = False,
284+
by_alias: bool | None = None,
285285
exclude_unset: bool = False,
286286
exclude_defaults: bool = False,
287287
exclude_none: bool = False,
288288
round_trip: bool = False,
289289
warnings: bool | Literal["none", "warn", "error"] = True,
290290
context: dict[str, Any] | None = None,
291291
serialize_as_any: bool = False,
292+
fallback: Callable[[Any], Any] | None = None,
292293
) -> dict[str, Any]:
293294
"""Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump
294295
@@ -320,10 +321,12 @@ def model_dump(
320321
raise ValueError("context is only supported in Pydantic v2")
321322
if serialize_as_any != False:
322323
raise ValueError("serialize_as_any is only supported in Pydantic v2")
324+
if fallback is not None:
325+
raise ValueError("fallback is only supported in Pydantic v2")
323326
dumped = super().dict( # pyright: ignore[reportDeprecated]
324327
include=include,
325328
exclude=exclude,
326-
by_alias=by_alias,
329+
by_alias=by_alias if by_alias is not None else False,
327330
exclude_unset=exclude_unset,
328331
exclude_defaults=exclude_defaults,
329332
exclude_none=exclude_none,
@@ -338,13 +341,14 @@ def model_dump_json(
338341
indent: int | None = None,
339342
include: IncEx | None = None,
340343
exclude: IncEx | None = None,
341-
by_alias: bool = False,
344+
by_alias: bool | None = None,
342345
exclude_unset: bool = False,
343346
exclude_defaults: bool = False,
344347
exclude_none: bool = False,
345348
round_trip: bool = False,
346349
warnings: bool | Literal["none", "warn", "error"] = True,
347350
context: dict[str, Any] | None = None,
351+
fallback: Callable[[Any], Any] | None = None,
348352
serialize_as_any: bool = False,
349353
) -> str:
350354
"""Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump_json
@@ -373,11 +377,13 @@ def model_dump_json(
373377
raise ValueError("context is only supported in Pydantic v2")
374378
if serialize_as_any != False:
375379
raise ValueError("serialize_as_any is only supported in Pydantic v2")
380+
if fallback is not None:
381+
raise ValueError("fallback is only supported in Pydantic v2")
376382
return super().json( # type: ignore[reportDeprecated]
377383
indent=indent,
378384
include=include,
379385
exclude=exclude,
380-
by_alias=by_alias,
386+
by_alias=by_alias if by_alias is not None else False,
381387
exclude_unset=exclude_unset,
382388
exclude_defaults=exclude_defaults,
383389
exclude_none=exclude_none,

0 commit comments

Comments
 (0)