Parsing errors caused by ChatGPT adding comments to the request bodies

Hey I noticed something interesting about requests coming to my API endpoints.

I am having ChatGPT infer some data from a topic and write it to my endpoint.

The issue is that ChatGPT is creating comments in the request body which causes a parsing error and the request to fail.

The cool part is that it tries it again without the comments after and self-corrects.

First of all this is awesome, writing plugin code is so fun and I am exciting to see all the cool plugins people create to help people.

Second of all, is it possible to prevent ChatGPT from creating the comments in the first place? I tried including “Do not create comments in request bodies” in the plugin manifest but It still does it once in a while.

Any ideas for how to prevent this?

Here is an example of what the request would look like and the resulting failure message.

 "itemName": "Notebook",
 "itemDetails": "3 units of 50-page notebooks",
 "itemPrice": 450,
 "blueCover": 9, // Estimated number of notebooks with blue cover
 "whitePages": 45, // Estimated number of white pages per notebook
 "ruledLines": 9 // Estimated number of ruled lines per page

ApiSyntaxError: Could not parse API call kwargs as JSON: exception=Expecting property name enclosed in double quotes: line 4 column 24 (char 90)



Seems like the solutions are

  1. play with different prompts or to
  2. use json5 to parse.

Ill give json5 a try eventually. It would be ideal if ChatGPT with Plugins was disallowed from generating comments in their requests bodies somehow.

1 Like