Assistant API is creating multiple mistake files. Assuming I'm getting charged

I prompt my GPT-4 assistant to creates a JSON file. Then the output goes something like this.

“Here’s the JSON we’ll create”

“Let me put that into a JSON file for you.”

“It seems I forgot to import the JSON package, Let me fix that.”

“It seems I used the python ‘True’ value instead of the JSON ‘true’ value. let me fix that.”

etc etc. And it does this nearly every time. Any ideas on how to avoid this?

So I end up with files like this when I ask for ‘Messages_and_Requests.json’:

  • Messages_and_Requests_Corrected.json
  • Messages_and_Requests_v2.json
  • Messages_and_Requests_v3.json
  • Messages_and_Requests_Simplified.json
  • Messages_and_Requests_Final_Correct.json
  • Messages_and_Requests_Final_Attempt_Corrected.json
  • Messages_and_Requests_Final_Proper.json

This is just a little bit ridiculous, right? Especially as I am getting charged for it?
Any ideas how I can curb this? I have literally said “REMEMBER TO INCLUDE the JSON python package and use the correct JSON true value.” but it doesn’t seem to help.

thanks!
-denny-

It is down to model selection, and the quality of the instructions given.

  1. Choose gpt-4-0613 as your assistant model if you want code that is not dumb
  2. Enable only code interpreter if you want AI without distraction
  3. Talk to the AI directly about the specifications of code that it will write to execute in the python sandbox, that it must reset the environment with reset command and start anew, writing completely valid code that will save a variable json_text to a json.txt file (if you want the AI actually doing the same as writing AI language to a mount point file), and then go from there. No json library needed for it to save text.
  4. You can also have processing done as python dictionary and list data objects, and then a final conversion to a json dump. Your instruction will refine the programming methods it can use.
1 Like