Please post your code as text and not as a screenshot so we can more easily read the code and help you @chris5 Post using Markdown with triple backticks, like this:
Not trying to be funny, but have you put the error and your code into ChatGPT or Bing Chat to debug? It might actually solve it.
That said, the error you posted is a JSON parsing error, which happens when one of your functions expects a JSON type object (e.g. {myData:‘data’}) and instead gets another type, like a String, Number or another type.
ChatGPT writes code and it’s useful for developers who know the code and syntax, but it’s generally buggy and not really reliable; so it can be hard for people who are not software engineers to debug.
You are better off to start with code from the OpenAI API docs or the cookbook, written and tested by domain experts and not by a hallucinating, text auto-completing engine.
Note, I could tell you code was ChatGPT generated blah blah, because of this line:
That API end point does not exist because it was deprecated. ChatGPT is full of deprecated code which is old and does not work, especially related to the OpenAI API. People who advise you to use ChatGPT to write OpenAI API based code simply do not understand that this is not possible because of the cut-off date for the pre-trained models.
It’s a mistake to use ChatGPT to write OpenAI API-based code because the cut-off date for ChatGPT models were mid to late 2021 and much of the API code has been deprecated and changed.
You need to refrain from using ChatGPT and go to the OpenAI API docs and cookbook to write and develop code using the OpenAI API.