You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Even if we use structured outputs, we find that sometimes the LLMs will still get enums or other values slightly wrong, causing the AI SDK to throw validation errors.
In some cases, LLMs will return "Constitution" instead of "constitution" on this schema:
What would be nice, is if I could generateObject with this as an input schema, but then pass in a validationSchema: which is what we check the validation against. With zod, this validation schema can also help us with fixing some of the data, using zod transforms.
If the validationSchema is not defined, it should default to schema for validation.
In the above example, even if the language model returned "stat: "cOnSTITution", the validationSchema would handle transforming that to lower case and validating it. The end result is I get the value I wanted from the call without dealing with an error.
I think this would be an incredible valuable feature in the AI SDK!
Use Cases
No response
Additional context
No response
The text was updated successfully, but these errors were encountered:
Feature Description
Even if we use structured outputs, we find that sometimes the LLMs will still get enums or other values slightly wrong, causing the AI SDK to throw validation errors.
In some cases, LLMs will return "Constitution" instead of "constitution" on this schema:
This throws an error.
What would be nice, is if I could generateObject with this as an input schema, but then pass in a
validationSchema:
which is what we check the validation against. With zod, this validation schema can also help us with fixing some of the data, using zod transforms.If the validationSchema is not defined, it should default to
schema
for validation.In the above example, even if the language model returned "stat: "cOnSTITution", the validationSchema would handle transforming that to lower case and validating it. The end result is I get the value I wanted from the call without dealing with an error.
I think this would be an incredible valuable feature in the AI SDK!
Use Cases
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: