4 Comments
User's avatar
Alejandro Piad Morffis's avatar

In this article I didn't go too deep into ensuring the JSON response was properly formatted, but in the book we tackle this problem more seriously and build a safe JSON parser that most of the time ensures the response is not only valid JSON, but actually conforms to a user-defined class. Feel free to ask if you want more details.

Expand full comment
Rene's avatar

I bought your book and tried to run the code, but I keep getting exceptions that seem to be related to the JSON problem. But actually, I want to run your code with OpenAI endpoints. Maybe that works better. At least in other projects my experiences with having GPT-4(o) produce JSON output were pretty good.

Expand full comment
Alejandro Piad Morffis's avatar

Yes, GPT4 is much better at JSON. I want to change the code to use the openai endpoints by default at some point.

Expand full comment
Stamatis Karlos's avatar

Thanks for the article, can you please verify that the streamlit link does work?

Expand full comment