OpenAI API JSON tip

Hi all
Just a little tip if you are using OpenAI, with the new models ‘gpt-3.5-turbo-1106’ ‘gpt-4-1106-preview’ you can now force a JSON object response:

response_format: {
            "type": "json_object",
        }

which can help make sure you get the response format you want, you do still need to say you want a JSON object in your prompt:
API Reference - OpenAI API

6 Likes