-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Support for validation libraries other than zod (or no validation) #1062
Comments
If you have a solution for supporting other libraries without sacrificing (too much of) the current DX then we might be able to ship it. As it is, zod should only be bundled on the server (and users likely have it available already), so we're not too worried about the bundle size. Can you make a PoC with what you're thinking about? cc @lgrammel |
I think it is a good idea to support other validation libraries. Currently we use Joi everywhere (front & backend) and now we have to support zod for our |
@robahtou many validation libraries are limited in the json schema conversion (the LLM use case is a bit more than just validation). zod has the advantage that it supports |
@lgrammel makes sense. In that case |
Also looking for this, ideally without enforcing the use of a validation library since we are allowing dynamic schema and pulling it in at runtime. |
I am the author of Valibot and am happy to help and answer questions. Since we are getting close to v1, it might make sense to start this process now. |
@fabian-hiller the crucial thing is json schema support (ideally with descriptions for individual properties), and a good match to what's possible in json schema (since that's what most llms use). the |
There is a JSON schema community library similar to Zod: https://github.com/gcornut/valibot-json-schema We are working on a metadata feature in the next few weeks to add custom information such as a description: fabian-hiller/valibot#373 |
Implemented in #2386 @fabian-hiller you could add support for valibot through a separate package that offers a function which takes a valibot schema and maps it to a AI SDK compatible JSON schema via the |
Thanks @lgrammel! I will take a closer look at this after we release our metadata feature. |
Landed in main |
@lgrammel we released our official |
Feature Description
Currently, the schema for tools and functions is created using
zod
andzod-to-json-schema
. However, the bundle size of zod is quite large, and it would be beneficial to support other validation libraries, such as valibot.If this idea is well-received, I can create a pull request to implement the support for additional validation libraries.
The text was updated successfully, but these errors were encountered: