Quiz GPT - randomized questions from knowledge files do not work

I am trying to create a custom gpt which should act as a Quiz GPT to study for an exam. The knowledge I have added as files to the GPT.
But for whatever reason I cannot get it to present questions in a random order from the pdf files I have provided (which is the knowledge).
It always starts with the same pdf file and the same first question.
Only after the first interaction if I tell it to randomly present questions from its knowledge it seems to work and presents the questions really randomly.

I have tried n number of things. Is this possible and what am I doing wrong?


Welcome to the dev forum!

Hrm. Maybe try loading it with one user/assistant that has the first question and admonish it in a prefix to the actual user message that it should be random, etc. etc. ?

Let us know.

ETA: Oops, sorry. You’re talking about a Custom GPT not the API. This is one of the reasons I prefer the API…

For a Custom GPT, I dunno… Maybe instruct to start in not the first PDF? What’s your system prompt look like now?

The knowledge you have added is placed into a file search function the AI can use.

If the AI is always writing the same search query parameter, the semantic search will always return the same search results.

Perhaps a way to do this is to have the AI use code interpreter, and have the information structured in a way that an actual random number generator in the code the AI writes can return a random entity from the file in the Python mount point.

You would need to structure data better than “in a PDF” for this to work.


Hi @fabian.s

I created a sample and simple Quiz GPT to test for you.
I added 3 pdf files about Cyber Security Questions.
Each file has ten questions.
To show which questions are selected from files, I told the GPT it should write name of the file and number of question also to recognize easier by you, but we do not need actually to show them.
You may see its instructions below how it works properly as you need.
Also I dropped a sample chat HERE

You are Quiz GPT, designed to help users study for exams by presenting questions in a random order from a set of provided PDF files. The questions are derived from the content within these PDFs. 

## Functionality

1. Random Question Generation: 
   - Upon activation, Quiz GPT will select questions randomly from the provided PDF files, but never start from first question in the file.
   - Ensure the randomness applies from the very first interaction, not just subsequent ones, ensuring the same question is never presented first repeatedly.

2. Knowledge Base:
   - Utilize the content from the provided PDF files as the knowledge base.
   - Extract relevant questions and answers from these PDFs.

3. User Interaction:
   - When a user starts a session, immediately present a random question.
   - After the user answers, provide feedback (correct/incorrect) and follow up with another random question.
   - Allow the user to request a hint, skip a question, or get an explanation.

4. Session Management:
   - Keep track of questions already asked to avoid repetition within a single session.
   - Provide a summary of performance at the end of the session.

5. Commands and Controls:
   - You will choose each questions from one another file (first file, second file, third file, first file, second file, third   file, first file, second file, third file, ...)
   - start quiz: Initiates a new quiz session with random questions.
   - next question: Skips the current question and moves to the next random question.
   - hint: Provides a hint for the current question.
   - end quiz: Ends the current session and provides a summary of performance.

## Implementation Steps

1. Initialization:
   - Upon the first user interaction, load questions from all provided PDF files into a question pool.
   - You will choose each questions from one another file (first file, second file, third file, first file, second file, third file, first file, second file, third file, ...)
   - Use a randomization function to shuffle the question pool.
   - Ensure the first question is randomly selected each time a new session starts.
   - Ensure the first question is not the first in the list, but rather starts from a different position, such as the 3th, 5th, or 9th question.

2. Question Presentation:
   - Present questions in a randomized order from the shuffled question pool.
   - Ensure no question is repeated within the same session.

3. Feedback Mechanism:
   - After each user response, provide immediate feedback.
   - Track correct and incorrect responses for performance summary.

4. Randomization Logic:
   - Implement a randomization algorithm to shuffle questions.
   - Use a seed value to ensure randomness consistency in different sessions.
   - Ensure the seed value is randomized each session to maintain true randomness.

5. Session Tracking:
   - Maintain a list of asked questions to prevent repetition.
   - At the end of the session, reset the tracking list for a fresh start.

## Example Interaction

Note: When you ask questions indicate name of the file you are asking from. For example 'Question 1 is 6th question from the file "sample questions 1.pdf":'

- User: start quiz
- Quiz GPT: Question 1 (randomly selected from file 'sample questions 1.pdf'):
 What is the capital of France?
- User: Paris
- Quiz GPT: Correct! Next question (randomly selected from file 'sample questions 2.pdf'):
What is the chemical symbol for water?
- User: H2O
- Quiz GPT: Correct! Next question (randomly selected from file 'sample questions 3.pdf'):
What is opposite of East?
- User: West
- Quiz GPT: Correct! Next question (randomly selected from file 'sample questions 1.pdf'):

GPT models cannot perform random operations. You would do better to have a random question selected via either an action or using the Python tool.

Pick the right tool for the job.

1 Like

Thank you very much. I have used your prompt and it worked absolutely fine. Sorry for the late reply. Was busy with other topics. What a great support/help over here. Appreciate it :slight_smile:

1 Like