Enable JSON mode for Assistant API

JSON mode is essential for building solutions that can consistently and predictably take actions based on Assistant API responses, specifically to deal with results from Runs. Instructing OpenAI to produce JSON in a specified format via prompts is otherwise unpredictable. I’ve spent days improving JSON parsers, until OpenAI APIs respond with yet another variation. JSON mode is already available for Chat API via the response_format parameter. It’s a must have for Assistant APIs too.

7 Likes

Couldn’t agree more. I don’t understand why it’s not available. One thing that has (kind of) worked is that I put additional_instructions in the run and tell it to only return JSON format and explicitly call out the keys. Make sure you don’t put it in the run instructions as it will override the assistant instructions. Then if I turn the temperature down, it works ~98% of the time. Hope that helps.

Json for Assistant API is now available. Hopefully Assistant API will be out of Beta TODAY!

1 Like

Really? mine is still restricted unless I put all of my tools in functions (I’m using File Retrieval and it precludes the use of json mode)

1 Like