-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Adding zod validation #690
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
Adding zod validation #690
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.
PR Summary
Added Zod schema validation across LLM clients to provide consistent, type-safe response handling and improved error reporting.
- Added new
types/zod.tswithvalidateZodSchemaWithResultutility for standardized schema validation - Introduced
CreateChatCompletionResponseValidationErrorfor structured validation failures - Implemented consistent validation in both GoogleClient and OpenAIClient with detailed error messages
- Added retry mechanism when validation fails in both LLM clients
- Aligned validation approach between providers while maintaining provider-specific response handling
💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!
4 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
…rlAltGiri/stagehand into giri/stagehand-zod-validation
|
Hey @CtrlAltGiri thanks for this PR! Going to push a couple changes to your branch here so that we can get this over the line |
c8cd199
into
browserbase:evals/CtrlAltGiri/stagehand-zod-validation
* Adding zod validation (#690) * Stagehand commits' * Update types/zod.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * using format() * minor update * minor update --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * add zodValidationError * use safeparse and throw informed error * changeset --------- Co-authored-by: Giridhar Balachandran <giridhar.balaz@gmail.com> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
why
Adding zod validation errors in the error response to ensure better debugging for developers.
Resolving issue: #689
what changed
test plan