fix(models): retry after pydantic schema rebuild error#3106
fix(models): retry after pydantic schema rebuild error#3106MukundaKatta wants to merge 2 commits intoopenai:mainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b0cd49aa3f
ℹ️ 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".
| ) | ||
|
|
||
| import pydantic | ||
| from pydantic.errors import PydanticUserError |
There was a problem hiding this comment.
Guard v2-only PydanticUserError import
Importing PydanticUserError at module load time breaks the declared pydantic>=1.9.0,<3 compatibility path: in Pydantic v1, pydantic.errors does not export PydanticUserError, so importing openai._models raises ImportError before the PYDANTIC_V1 branch can short-circuit. This would fail all v1 environments (including the repo’s test-pydantic-v1 nox session) even though the new retry logic is only intended for v2.
Useful? React with 👍 / 👎.
Per @chatgpt-codex-connector review: pydantic.errors.PydanticUserError does not exist in pydantic v1, so importing it at module load time breaks the declared >=1.9.0,<3 compatibility path and fails the test-pydantic-v1 nox session before the PYDANTIC_V1 branch in _get_extra_fields_type can short-circuit. Wrap the import in try/except ImportError and fall back to a local Exception subclass. On v2 the real PydanticUserError is used. On v1 the fallback is unreachable at runtime because _get_extra_fields_type returns early via 'if PYDANTIC_V1'.
|
Addressed @chatgpt-codex-connector review: wrapped |
|
Note To use Codex here, create a Codex account and connect to github. |
Summary
Testing