Open
Description
Confirm this is an issue with the Python library and not an underlying OpenAI API
- This is an issue with the Python library
Describe the bug
Release 1.16.1 broke clients by deferring the build if pydantic models. As a result, doing a model_dump()
on an object returned by the library can fail.
While this speeds up build times, it should be considered a breaking change and ideally, avoided.
If the speedup is significant, we would request not using a generic envvar like DEFER_PYDANTIC_BUILD
to revert the change, instead using something like OPENAI_PYDANTIC_DEFER_BUILD
.
We noticed this issue with a streaming tool call message, and are not sure if other deep classes exhibit this behaviour.
To Reproduce
- Create a streaming tool call chat completion message.
- Call
model_dump()
on the object. - Observe stack trace in pydantic serializer code.
Code snippets
No response
OS
macOS, Linux
Python version
Python v3.11.8
Library version
openai v1.16.1