Streaming JSON from OpenAI API
OpenAI APIs can take up to 10 seconds to respond. It's too long for a user to wait. So instead we should stream results to a user. It's easy with text, but dealing with JSON is not straightforward. This blog posts explains how to work around it.
mikeborozdin.com