Re:Native JSON Output from GPT-4
by rytill on Wednesday June 14, 2023 @06:15PM
(#36333533)
Did you try using the API and providing a very clear system message followed by several examples that were pure JSON?
[ Parent
| on HN ]
Yep. I even gave it a JSON schema file to use. It just wouldn't stop added extra verbage.
Say it's a json API and may only reply with valid json without explanation.
Lol yes of course I tried that.
I've had good luck with both:
https://github.com/drorm/gish/blob/main/tasks/coding.txt
and
https://github.com/drorm/gish/blob/main/tasks/webapp.txt
With the second one, I reliably generated half a dozen apps with one command.
Not to say that it won't fail sometimes.
Combine both ? :)
Re:Native JSON Output from GPT-4
by taylorfinley on Wednesday June 14, 2023 @08:02PM
(#36334640)
I just use a regex to select everything between the first and last curly bracket, reliable fixes the “sure, here’s your object” problem.