Closed Cardosaum closed 11 months ago
Nice! Good catch too. I haven't encountered that one yet, but I knew it was a possibility.
Can you change the returned message of "Failed to parse response from API" to something more like: "Received invalid JSON"?
The reason is, when we get bad JSON in a function call from the ChatGPT, we can just return the following example text to as the function response to ChatGPT.
"ERROR: Received invalid JSON"
Then ChatGPT will may try again with better formatted JSON. Optionally, we could include more of the error message so ChatGPT has a better chance of fixing the problem.
Oh, I see... Thanks for the additional context!
I have updated the error message as per your suggestion. Now it reads "Received invalid JSON: %Jason.DecodeError{...}"
.
Is there any other improvement or change you'd like to have implemented?
❤️💛💙💜
This should fix #20.