I’m developing a Trivial project and I wanted ChatGPT to generate some questions and answer for me.
I created small project to query ChatGPT and reply with json format strings to populate a local database (so to speak).
The prompt is the following:
-BEGIN_PROMPT-
I’m working on a Trivial software project. The main language of the project is going to be Spanish. I would like you to help me to generate some questions in Spanish but the source code and the json fields are going to be in English.
The output format must be a valid json to be consumed by the Trivial project.
The expected output must have the following fields:
* category: one of the following
- “Geografía”
- “Entretenimiento”
- “Historia”
- “Arte y Literatura”
- “Ciencia y Naturaleza”
- “Deportes y Ocio”
* question: an object with the following fields:
- “question”: the actual question to be answered.
- “answers”: an array with the possible answers. 4 answers are expected but just one is the right one.
- “rightAnswer”: an integer pointing the single right answer of the “answers” array where index starts at 0.
Please, do not repeat questions.
Could you generate an example for the “Geografía” category?
-END_PROMPT-
I found a thread which was helpful on how to use temperature and top_p parameters (no link as it is not allowed in the forum).
I set the parameters to:
n: 10 (to have ten choices)
temperature: to high value and to low values (testing outcomes)
top_p: to high value and to low values (testing outcomes)
The prompt is working fine but it is returning a repeated questions most of the times.
I’ve checked in the chatGPT web client and if I asked for another example and it’s giving me different questions all the time.
Is there something I could change to make it give different questions (temperature, top_p, the model, the prompt, …)?
Are you sending context (ie the first set of questions?) If you don’t send the “context” each time, it could start to repeat. ChatGPT is sending all the information every time, so it tends to repeat less.
Hope this makes sense. If not, let us know.
Sounds like you’re not sending entire conversation history, though.
I’m not currently sending the “context” (which makes sense in order not to repeat the answer and I will have to add it in the future to avoid repeat answers) but I’m actually talking about the “n” choices I get in the very first response.
Let me post an actual reponse ( I remove data here and there so do not pay attention to the json format)
{
“id”: “…”,
“model”: “gpt-3.5-turbo-0125”,
“choices”: [
{
“index”: 0,
“message”: { … "question": "¿Cuál es la capital de Francia?", … }
},
{
“index”: 1,
“message”: { … "question": "¿Cuál es la capital de Francia?", … },
},
{
“index”: 2,
“message”: { … "question": "¿Cuál es la capital de Francia?", … },
}
…
}
As you can see in the same response questions are being repeat. Randomly you can find a different one but I was expecting 10 different questions on the same response.
Well, it’s not so much a parameter as a concept… but yeah, sending the previous messages will help it stop repeating so much… that’s the behavior you’re seeing in ChatGPT likely.
Setting the “n” parameter to 1 (I think is the default value by default as well)
and using the context (adding all messages, “assistant” and “user”, to “messages”) I’m getting new questions on each new query.
I guess this will last until the messages reach model tokens limit as older tokens will be “forgotten” so to speak.
Again, thanks for your support and the tips towards the right approach.