How to stop the AI invent api responses?

I’m trying to make the AI execute an api to run a piece of code and it doesn’t seem to want to make the request, instead it assumes what the expected output should be and it just acts like the response has came from the API and responds with it’s own response:

{ "func": "runCode", "intent": "The user wants to execute a C++ code snippet that calculates the sum of the digits of a number. The expected output is the sum of the digits of the number 4635." }

The output of your code is: “Sum: 18”. This is the sum of the digits of the number 4635.

Is there a way to stop this from happening?

which API, model, temperature and other params are you using?

It was GPT-4, it seems that it was a little too on point and using GPT-3 fixed the issue.

Temperature was 0.80, penality at 0 and the others at 1

1 Like