fix: rename DEFER_PYDANTIC_BUILD to OPENAI_PYDANTIC_DEFER_BUILD - #3720
fix: rename DEFER_PYDANTIC_BUILD to OPENAI_PYDANTIC_DEFER_BUILD#3720SparshM8 wants to merge 3 commits into
Conversation
This addresses issue openai#1306 by renaming the internal environment variable to be library-specific, avoiding potential conflicts with other Pydantic-based libraries. Also fixes a typo in coerce_boolean utility.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0cdaa122e6
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| model_config: ClassVar[ConfigDict] = ConfigDict( | ||
| extra="allow", defer_build=coerce_boolean(os.environ.get("DEFER_PYDANTIC_BUILD", "true")) | ||
| extra="allow", | ||
| defer_build=coerce_boolean(os.environ.get("OPENAI_PYDANTIC_DEFER_BUILD", os.environ.get("DEFER_PYDANTIC_BUILD", "true"))), |
There was a problem hiding this comment.
Stop honoring the conflicting unscoped variable
When another Pydantic-based library sets only DEFER_PYDANTIC_BUILD—the collision this rename is intended to fix—this fallback still applies that foreign value to OpenAI's BaseModel, so the scoped rename does not isolate OpenAI unless users also define the new variable. Since the repository's test runner now sets the scoped name, remove the unscoped fallback (or otherwise constrain it to an explicit migration path) so unrelated environments cannot alter OpenAI model construction.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 87155fbdc5
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| def get_abort_reconciliation_items(self) -> List[Dict[str, Any]]: | ||
| """Returns a list of synthetic function_call_output items for any pending tool calls. | ||
|
|
||
| This should be used if the stream is closed before it has been read to completion | ||
| to ensure that the conversation state remains consistent. | ||
| """ | ||
| return self._state.get_abort_reconciliation_items() |
There was a problem hiding this comment.
Remove the unrelated streaming API addition
This environment-variable rename also adds a public ResponseStream method plus substantial reconciliation state machinery that is unrelated to the stated fix and has no focused synchronous or asynchronous tests. Because ResponseStream is re-exported from openai.lib.streaming.responses, merging this commit would silently expand the supported SDK API with unvalidated semantics; move these _responses.py changes to the dedicated feature change instead.
AGENTS.md reference: AGENTS.md:L5-L8
Useful? React with 👍 / 👎.
| for output in snapshot.output: | ||
| if output.type == "function_call": |
There was a problem hiding this comment.
Skip calls that already have an output
When a streamed response contains both a function_call and its corresponding function_call_output—both are valid ResponseOutputItem variants and the accumulator retains both—this loop still emits another synthetic output for that call ID. Passing the returned reconciliation list into the next request can therefore submit two outputs for an already-satisfied call; collect existing output call IDs and exclude them here.
Useful? React with 👍 / 👎.
This addresses issue #1306 by renaming the internal environment variable to be library-specific, avoiding potential conflicts with other Pydantic-based libraries. Also fixes a typo in coerce_boolean utility.
Changes being requested
Additional context & links