ChatGPT AI: Guess a Historical Figure (Difficulty: 3)
-
Introduction
In the previous tutorials, you learned how to build a simple chat app with ChatGPT. In this tutorial, we will build a learning game called “Who Am I?”. We will make ChatGPT pretend it is a historical figure, and have the user guess who that person is:
You will find that there is almost no code change, and most of the work is in rewriting the prompt. This may change how you think about “coding”. A new skill is needed if you want to build fun projects using ChatGPT: writing great prompts to get ChatGPT to do exactly what you want. In a way, you just need a new prompt to build a new app!
Step 1 - Create a Starting Project
We will use the project from the previous tutorial as the starting point. If you don’t have it, you can follow that tutorial to build one, or remix the following project:
play.creaticode.com/projects/1d57389810eb8ce8b178c684
Step 2 - Clean Up
Before we add a new prompt to the project, let’s clean it up:
- Remove the prompt in the system request. We will work on this later.
- Change the name of ChatGPT from “Einstein” to “AI” or some other name you like.
Step 3 - Write the Prompt: Describe the Scenario
The entire work will be about writing a new prompt, which will be completed in a few steps.
For the first step, it’s essential to describe the scenario so that ChatGPT “knows” what it is expected to do.
For our game, we can describe it like this:
You are a 5th-grade history teacher and the user is a 5th-grade student. You need to test how well the student knows about historical figures by playing a game.
Feel free to adjust the student’s grade level or the role of the chatbot. You need to type or copy the description into the request box of the system request block. Note that when the request is long, it will fold into multiple lines automatically.
Step 4 - Write the Prompt: Describe the Game Rules
With the given prompt above, ChatGPT knows it needs to test a student’s historical knowledge through a game. However, it still doesn’t know the exact rules of the game. We need to give it clear rules on what it should and should not do, such as:
In this game, you pretend to be a historical figure, but you do not tell the student who you are pretending. The student has to guess who you are by asking you questions.
Again, put this into the request input box. Note that you can hold down the CTRL key then press the ENTER key, which will start a new line in the request input.
Step 5 - Write the Prompt: Describe What to Do Next
Now our chatbot is ready to play the game. However, we still need to tell it what to do to get the game started. For example, we can make it wait for the user to start asking the first question:
Now wait for the student's question, then answer the question as if you are that historical figure.
Again, add it to the request input box:
Step 6 - Instruct the User
Now our chatbot is ready, we still need to explain to the user how to play the game. We can tell the user to start asking questions with a new chat message like the one below, as if the historical figure is talking to the user directly:
Step 7 - Test Our Game
Now we have completed the changes. It’s very important to thoroughly test it. You need to think about what users would do to break your game.
For example, we should test if the chatbot would stick to the game rules.
Next, we should test if the chatbot can guide the user properly:
Lastly, test if our chatbot knows when to end the game. Note that even if we have a typo (“Jeferson” instead of “Jefferson”), ChatGPT can still correctly guess what we meant:
If you find any issues during the test, think about how to improve the prompt to prevent them. For example, if you do not want ChatGPT to discuss anything besides the game, you can add this to the prompt:Do not respond to any topic unrelated to this game."
Step 8 - Fix the “First Name” Issue
One issue you may find is that when the user asks “what’s your first name”, our AI will give out the answer right away:
To fix this issue, we need to add some additional rules to our prompt. For example, we can append this sentence:Do not give out your first name or last name in any format.
Now if you try to ask for the first name, you will get an answer like this:
Creative Ideas
Besides historical figures, you can modify the prompt to test the user on other topics. The choice of topics is almost infinite. Here are some fun examples:
- Guess a planet in our solar system
- Guess an invention or inventor
- Guess an animal or a plant
- Guess a literary character
- Guess a country or a place on Earth
- Guess a chemical element
- Guess a word or a number
You should also continue to find other ways to improve the prompt, and make the game more robust against trick questions.Another challenging problem is how to make the historical figure more random. Currently, ChatGPT is very likely to pick the few famous presidents, which makes the game really easy to play.
-
info-creaticode
-
hi whats the character