Using the Assistants API with Code Interpreter enabled, I have an assistant that regularly returns a properly-formatted JSON file for download as the end of the thread. The entire thread prompting works well, reliably returning accurate text in the correct format.
But 1 out of every 10-20 times, the JSON returned is formatted with single-quotes, rendering it invalid.
This is clearly a bug since the structure of the output file and information contained within appears correct, but the model/Code Interpreter is not following valid JSON specifications.
Rather than decreasing temperature, it’s probably better to decrease top_p.
The model probably “knows” that ’ isn’t the best choice, but it’s still a choice. Top_p eliminates the possibility of it getting randomly picked if that is the actual problem. At least that’s my understanding of how it works. @_j is an expert at this if you need more help.
but if it’s a direct output from the code interpreter (i.e. you’re generating and saving a file) - then you may need to tell code interpreter what tool you want used. Maybe it’s a JSON5 thing, but this is just a wild guess. Do you have records of where it went wrong?
I am using the Assistants API which does not allow for setting the temperature, but does directly invoke the Code Interpreter tool and specifies file output.