-
Notifications
You must be signed in to change notification settings - Fork 167
chore: upgrade python sdk to pydantic v2 #2030
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
chore: upgrade python sdk to pydantic v2 #2030
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codex Review: Here are some suggestions.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
| @model_validator(mode="before") | ||
| def infer_defaults(cls, values: dict[str, Any]) -> dict[str, Any]: | ||
| """Assign name to the run.""" | ||
| if values.get("name") is None and values.get("serialized") is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P1] Decorate RunTree pre-validator as classmethod
The new infer_defaults validator is registered with @model_validator(mode="before") but isn’t a classmethod. Pydantic v2 invokes mode="before" validators on the class, so defining it as an instance method causes a TypeError when constructing a RunTree (infer_defaults() is missing the positional values argument) and prevents any run tree from being created. Add @classmethod (and keep cls as the first parameter) so the validator runs correctly.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nvm the ai is wrong here this is untrue
|
@codex fix comments |
|
To use Codex here, create an environment for this repo. |
|
requesting reviewers please. also currently running this PR in prod, no issues yet. |
Summary
Testing
Notes
Fixes #2029 .