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
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: