Chatgpt API response parsing

Hello,

Firstly, i hope i am asking in the correct community/forum.

I am trying to make a meal planner. I am using Django with 2 basic pages, one for user input and the other one has a table which is dynamic. i am going to plug the response from chatgpt into my table by parsing the response properly.

The issue is, for some reason, chatgpt is not deterministic. For the same query, sometimes it responds that it can not create a meal plan because it is not a professional nutritionist and sometimes it returns a response with a proper meal plan. And even when it returns a proper meal plan, when running the query multiple times, the structure of the meal plan is different. I am not a professional programmer but is there a way to transform the data into json? i tried to specify it in the query but it did not work.

I am using chatgpt3-turbo. When inserting the same query in the web application, i get a perfect response.

What could be the problem?
I would appreciate every single hint.
Thanks and i hope you have a nice day!

Hey rafnas,

You can try zeroshot training, which is just a fancy way of saying add an example of the out put. Additionally, to reduce randomness you can reduce temperature, frequency penalty, and drop top p to 0 so you are just choosing the most probable output.

1 Like

Thank you very much for your fast answer.

It finally worked.

All left to do is read and understand why it worked. Does it have anything to do with the model?

Thank you again and have a nice day!

1 Like

Here is the link to the documentation on the parameters.

The parameters I mentioned all deal with creating a more random output. Instead of choosing the most probable output, I can choose to shake up the choices by adjusting the temperature or which cluster of tokens I can pick from. It actually takes a bit of code to get it working like that, but in your case, you just needed the most probable so you turn down all of the parameters responsible for “shaking up the bag” so to speak.

As for the mode. Chat GPT is basically a “predict what comes next” model. In chat mode, you are telling the model to predict what the rest of the conversation is by adding tags of the speakers. In this mode I showed, you are just telling it to complete the document.