← Back to all tweets

Tweet by @zirkelc_

View original on X

Schema mismatch errors happen frequently with weaker models like gpt-4o-mini I just learned that @aisdk exposes a `repairText` callback function to fix invalid json Then we can simply use `jsonrepair` to fix it https://t.co/Qf9jrAUwEu

Image
Matt Pocock
Matt Pocock
@mattpocockuk

jsonrepair just saved my bacon Generating structured outputs from Haiku but kept getting invalid JSON back. Sticking in a jsonrepair step put the success rate back to 100%. Even the image below is considered valid:

Image
517
Reply