Hacker News new | ask | show | jobs
by iamflimflam1 1153 days ago
GPT4 is much better than GPT3.5 at producing valid JSON and nothing else.

What I’ve found quite useful is to extract text from the first { and last }. This solves the problem of GPT adding some “helpful” explanations outside the JSON.

1 comments

I really wanted to use GPT-4 but still just waiting in line :( I should add in your tip, would save me a retry call every now and then I’m sure.
There are also some more lenient JSON parsers that will handle comments and other non-standard things. They can be a bit hard to add in to some frameworks as it’s kind of the opposite of what you are normally trying to do which is reject bad input.