JSON parser for AI
For almost three years I've been using LLMs in production systems. They have gotten way better than in the beginning. Still, when you request JSON, things often go wrong: chatter, fences, or, now that models spend more tokens thinking than answering, token exhaustion.
I've put a part of the code I use on npmjs.com as a library: euqai-json-repair.
It has two functions depending on your needs:
- Fully local (parseAiJsonSync): Fixes the JSON locally on your machine with zero network calls.
- With AI escalation (parseAiJson): Tries to fix it locally first, and only as a last resort escalates to euqai.eu where an LLM attempts to reconstruct it.
I hope it can be helpful in your projects: https://www.npmjs.com/package/euqai-json-repair
0
Upvotes