Skip to content

Commit 973c18b

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
chore(internal): update pydantic compat helper function (#1607)
1 parent 3e19a87 commit 973c18b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/openai/_compat.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import pydantic
88
from pydantic.fields import FieldInfo
99

10-
from ._types import StrBytesIntFloat
10+
from ._types import IncEx, StrBytesIntFloat
1111

1212
_T = TypeVar("_T")
1313
_ModelT = TypeVar("_ModelT", bound=pydantic.BaseModel)
@@ -133,17 +133,20 @@ def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str:
133133
def model_dump(
134134
model: pydantic.BaseModel,
135135
*,
136+
exclude: IncEx = None,
136137
exclude_unset: bool = False,
137138
exclude_defaults: bool = False,
138139
) -> dict[str, Any]:
139140
if PYDANTIC_V2:
140141
return model.model_dump(
142+
exclude=exclude,
141143
exclude_unset=exclude_unset,
142144
exclude_defaults=exclude_defaults,
143145
)
144146
return cast(
145147
"dict[str, Any]",
146148
model.dict( # pyright: ignore[reportDeprecated, reportUnnecessaryCast]
149+
exclude=exclude,
147150
exclude_unset=exclude_unset,
148151
exclude_defaults=exclude_defaults,
149152
),

0 commit comments

Comments
 (0)