ChatGPT AI: MBTI Personality Test (Difficulty: 3)
-
Introduction
In the previous tutorials, you learned how to build simple chat apps powered by ChatGPT. In this tutorial, we will create an interesting app that can determine the user’s MBTI type by asking them a few questions. It will serve as an example for crafting more complex prompts and handling undesirable responses from ChatGPT.
MBTI Types
The Myers-Briggs Type Indicator (MBTI) is a widely used personality assessment tool that categorizes individuals into 16 distinct personality types, each represented by a four-letter code, such as “INTJ” or “ESFP.” Each letter represents a different aspect of your personality.-
E (Extraversion) or I (Introversion): “E” indicates an outgoing nature, whereas “I” signifies a preference for solitude.
-
S (Sensing) or N (Intuition): “S” types are detail-oriented and practical; “N” types prefer ideas and abstract concepts.
-
T (Thinking) or F (Feeling): “T” types base decisions on logic and objectivity; “F” types prioritize empathy and emotions.
-
J (Judging) or P (Perceiving): “J” types are structured and prefer clear plans; “P” types are spontaneous and adaptable.
Of course, there are many more variations in personality types than these 16, but they serve as a good approximation that’s simple to understand.
How ChatGPT Can Help
Traditionally, to accurately determine a person’s MBTI type, a questionnaire with numerous questions must be created, and then a complex algorithm is used to analyze the results. Needless to say, this is a pretty complex application, which requires a significant amount of time and money to develop. Additionally, the questions are often abstract and tedious.However, with AI models like ChatGPT, we can build such an app fairly easily, and we can also design the questions to be much more interesting and relatable.
Here is what the app looks like:
Step 1 - The Starting Project
You can remix the following template project to use it as a starting point:play.creaticode.com/projects/6519f719fc9a5a6d14882a11
This project utilizes a system request at the beginning to explain what we are trying to achieve, and then proceeds with the chat between the user and ChatGPT.
Step 2 - First Version of Our Prompt
We only need to do one thing to build this app: design a great prompt. We will begin with a basic version, then refine it over time.To get started, here is our first version, which tells ChatGPT what it should do:
determine the user’s MBTI type by asking some questions.
Put that prompt into the system request block:
When we run the program, we will sometimes get a response from ChatGPT like this:
Clearly, ChatGPT is being cautious, but that is not necessary here, since the user already knows this is an MBTI test.In some other runs, you might get a response like this:
As you can see, the first sentence sounds more like a response than a greeting, and it asks too many questions.How can we improve our prompt so that it simply greets the user and asks only an open-ended question?
Step 3 - Make ChatGPT Ask the First Question
To make sure ChatGPT would dive into the questions directly, we can request it to start asking the first question like this:
determine the user’s MBTI type by asking some questions. Now greet the user and ask the first question.
Now, ChatGPT will indeed start asking the first question:
Step 4 - Change the First Question
The first question from ChatGPT is almost always like this: “Do you prefer spending time alone or being around other people?”. The issue is that everyone would receive the same questions, and it is not very engaging for the user.To address this issue, we can ask ChatGPT to begin by prompting the user for their favorite activity. Suppose the user answers “reading books,” then we will instruct ChatGPT to follow up with questions related to reading books. That’ll make the test much more relatable to the user.
We can change the prompt like this:
determine the user’s MBTI type by asking some questions. Now greet the user and ask the user a question about his/her favorite activity.Here is the updated question from ChatGPT:
Step 5 - Control Follow-up Questions
After the user answers the first question about their favorite activity, you may find that ChatGPT sometimes continues to focus on that activity and “forgets” about the task of MBTI testing. The problem lies in our prompt: we asked ChatGPT to ask the user about their favorite activity but did not provide instructions on what to do afterwards, so ChatGPT assumed it should continue with that task. Note that this problem does not always occur, as ChatGPT’s responses are random.To address this issue and refocus ChatGPT back to the main task, we need to add some additional instructions:
determine the user’s MBTI type by asking some questions. Now greet the user and ask the user a question about his/her favorite activity. After that, ask follow-up questions regarding that activity to find out the user’s MBTI type.
Now we managed to get ChatGPT back to the MBTI questions:
However, a new problem arises sometimes: ChatGPT asks too many questions at once. Can you try to force ChatGPT to ask only one question at a time?
Step 6 - One Question at a Time
To make ChatGPT ask one question each time, you can add some additional instructions:
determine the user’s MBTI type by asking some questions. Now greet the user and ask the user a question about his/her favorite activity. After that, ask follow-up questions, only one question at a time, regarding that activity to determine the user’s MBTI type.
Now we will only get one follow-up question after the user answers with their favorite activity:
Another example:
Step 7 - Multi-Choice Questions
Currently, all the questions generated by ChatGPT are open-ended. The user would need to type a few words to do the test. To make it easier, we can ask ChatGPT to offer multiple choices, so the user only needs to type a letter to answer each question.We can make that happen with this change in the prompt:
determine the user’s MBTI type by asking some questions. Now greet the user and ask the user a question about his/her favorite activity. After that, ask follow-up questions, only one question each time, regarding that activity to find out the user’s MBTI type. The questions should have multiple choices.
Now the questions will look like this:
However, sometimes we get another problem after some testing: even the first question becomes a multiple-choice question like this:
That’s not ChatGPT’s fault. In our prompt, we said “The questions should have multiple choices”, which indeed includes the first question. To fix that, we need to exclude the first question:
determine the user’s MBTI type by asking some questions. Now greet the user and ask the user a question about his/her favorite activity. After that, ask follow-up questions, only one question each time, regarding that activity to find out the user’s MBTI type. The questions should have multiple choices, except that the first question is open-ended.
Step 8 - The Test Result
Last but not least, we will ask ChatGPT to report the test result after a few questions. To keep the test quick, we can limit it to up to 5 questions like this:
determine the user’s MBTI type by asking some questions. Now greet the user and ask the user a question about his/her favorite activity. After that, ask follow-up questions, only one question each time, regarding that activity to find out the user’s MBTI type. The questions should have multiple choices, except that the first question is open-ended. After at most 5 questions, report your prediction on the user’s MBTI type with detailed explanations.
Here is the final demo of our app:
Additional Challenges
Although this app functions reasonably well, several aspects can be improved. Here are some ideas for you to explore:- Remove unnecessary words: ChatGPT is often very chatty, and it adds extra information to make the conversation smooth. For example, the last sentence here is unnecessary. Can you try to make ChatGPT more concise?
-
Besides “favorite activity”, can you think of other fun ways to kick off the conversation? How to get your users more engaged as they use your app?
-
Test your app thoroughly, and if you find any additional problems, try to enhance the prompt to address those problems. For example, if the app does not consistently determine someone’s MBTI type, then you might need to update the number or type of questions.
-
[More advanced] Besides personality test, there are many other similar tests that are suitable for such a chat-based interface, such as Career Aptitude Assessment, Communication Skills Assessment, Leadership Style Assessment, etc. Can you try to create a new app for such a test?
-
-
info-creaticode