Allow autoevals to support both zod 3 and zod 4 - #155
Merged
Conversation
Caitlin Pinn (cpinn)
force-pushed
the
caitlin/update-zod4
branch
from
December 23, 2025 23:40
60fce6c to
1184016
Compare
Braintrust eval reportAutoevals (caitlin/update-zod4-1780606355)
|
Use native toJSONSchema() method from Zod v4 instead of relying on zod-to-json-schema library which is not compatible with Zod v4. Fixes "Invalid schema for function" errors where schemas had 'type: "None"' instead of 'type: "object"'. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Replace direct zodToJsonSchema call with schemaToJson helper for classify_statements function to properly use Zod v4's native toJSONSchema() method - Format JSON dataset files and pnpm-lock.yaml with prettier This completes the Zod v4 compatibility fixes for OpenAI function calling schemas. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Caitlin Pinn (cpinn)
marked this pull request as ready for review
December 29, 2025 16:37
Caitlin Pinn (cpinn)
marked this pull request as draft
December 29, 2025 16:38
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] |
Contributor
Author
There was a problem hiding this comment.
issue with sdk tuple behavior in 3.8, 3.8 has been end of life since 2024
Caitlin Pinn (cpinn)
force-pushed
the
caitlin/update-zod4
branch
from
December 29, 2025 18:59
4d528b9 to
947418a
Compare
Upgrade to zod 4.2.1 in preparation of zod 4+ migration. Export from zod/v3 until everything is ready in the braintrust backend
Added Zod as a peer dependency accepting both v3 and v4 (^3.0.0 || ^4.0.0). This ensures consumers have a compatible Zod version installed while allowing flexibility for projects using either Zod 3 or 4. Zod remains in dependencies for build/test purposes, but declaring it as a peer dependency prevents version conflicts when autoevals is used in projects with their own Zod version.
Caitlin Pinn (cpinn)
force-pushed
the
caitlin/update-zod4
branch
from
December 29, 2025 20:17
e1137b0 to
2be0919
Compare
Caitlin Pinn (cpinn)
force-pushed
the
caitlin/update-zod4
branch
from
December 29, 2025 21:15
cef27af to
7d36c10
Compare
Caitlin Pinn (cpinn)
marked this pull request as ready for review
December 29, 2025 21:16
| "openai": "^6.3.0", | ||
| "zod": "^3.25.76", | ||
| "zod-to-json-schema": "^3.24.6" | ||
| "openai": "^6.7.0", |
Contributor
Author
There was a problem hiding this comment.
6.7.0 version is necessary in order to properly support zod 4 with fallbacks to zod 3
Stephen Belanger (Qard)
approved these changes
Jan 13, 2026
Caitlin Pinn (cpinn)
marked this pull request as draft
January 13, 2026 02:27
Contributor
Author
|
Sadly this change is still failing some internal integration tests and I hadn't been able to figure out why yet. There is still a lot more to be done on the overall zod upgrade. |
5 tasks
Caitlin Pinn (cpinn)
marked this pull request as ready for review
June 4, 2026 19:45
Caitlin Pinn (cpinn)
force-pushed
the
caitlin/update-zod4
branch
from
June 4, 2026 20:52
2c3e5bd to
0882888
Compare
Braintrust eval report
|
Abhijeet Prasad (AbhiPrasad)
approved these changes
Jun 8, 2026
Braintrust eval report
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Allow autoevals to install either zod 3 or zod 4.
The typescript sdk was updated to allow zod to be a peer dependency in order to work with either zod 3 or zod 4.
This PR makes a similar update to the autoevals package and runs a matrix with zod 3 and zod 4 over the existing tests.
Our internal uses of autoevals does not allow for a direct upgrade to zod v4 at this time but the peer dependency should unblock users use of using autoevals with zod 4.