Home

Awesome

PsyDI

<div align="center"> <img width="1000px" height="auto" src="https://github.com/opendilab/PsyDI/blob/main/assets/banner.png"></a> </div>

English | 简体中文(Simplified Chinese) | 🔥PsyDI Paper

Introduction to PsyDI

PsyDI is a multi-modal and interactive chatbot for psychological assessments. Its objective is to explore users' potential cognitive styles through interactive analysis of their multimodal inputs, finally determining their Myers-Briggs Type Indicator (MBTI). Additionally, PsyDI offers feedback in the form of customized figures and detailed analysis for each user. We are continuously improving PsyDI, with upcoming features such as an MBTI gallery. Your feedback is valuable to us!

Access PsyDI: English version | Chinese version

:boom: News!

CharacterIntroductionMBTIFigure
Yor Forger (SPY×FAMILY)Yor Forger is a skilled assassin with a gentle heart, who disguises herself as a government official and becomes an integral part of the makeshift family in the "SPY×FAMILY" series.ISFJ<img width="120px" height="auto" src="https://github.com/opendilab/PsyDI/blob/main/assets/yor.png"></a>
Anya Forger (SPY×FAMILY)Anya Forger is a telepathic schoolgirl with a mischievous streak, who unknowingly plays a pivotal role in her adoptive family's covert activities in the "SPY×FAMILY" narrative.ENFP<img width="120px" height="auto" src="https://github.com/opendilab/PsyDI/blob/main/assets/anya.png"></a>
Jinx (League of Legends)Jinx is an anarchic and explosively playful marksman in "League of Legends," known for her chaotic streak and dual-wielding firearms that unleash a hailstorm of chaos on the battlefield.ESFP<img width="120px" height="auto" src="https://github.com/opendilab/PsyDI/blob/main/assets/jinx.png"></a>
Viktor (League of Legends)Victor is a brilliant and relentless inventor in "League of Legends," who wields his advanced Hex Core technology to manipulate the battlefield and eradicate his enemies with a blend of strategic disintegration and relentless augmentation.INTJ<img width="120px" height="auto" src="https://github.com/opendilab/PsyDI/blob/main/assets/viktor.png"></a>
Phoebe Buffay (Friends)Phoebe Buffay is a charming character in "Friends", known for her quirky, humorous, and unconventional personality, along with a range of unique life experiences and perspectives. Phoebe was once a street performer, crafting songs filled with personal flair and humor. Her relationship with her biological father, her love for animals, and her support and care for her friends all add much joy and vibrancy to the show.ENFP<img width="120px" height="auto" src="https://github.com/opendilab/PsyDI/blob/main/assets/phoebe.png"></a>
Twilight (SPY×FAMILY)Twilight (Loid Forger) is the top spy from the West Country. In order to carry out his espionage mission, he temporarily formed a family and adopted Anya, who was originally an orphan. As time goes by, Loid, who was originally focused on the mission, began to genuinely care about the temporary family and started to seriously consider how to permanently settle them after the mission and conceal the secret that he is a spy.INTJ<img width="120px" height="auto" src="https://github.com/opendilab/PsyDI/blob/main/assets/loid.png"></a>
Chandler (Friends)Chandler Bing is a character from "Friends". He is Ross's college roommate, known for his humorous and witty remarks, often making fun of himself to entertain others. He develops a romantic relationship with Monica and eventually marries her. Known for his wit and humor, Chandler is the comic relief of the series.ENTP<img width="120px" height="auto" src="https://github.com/opendilab/PsyDI/blob/main/assets/chandler.png"></a>
An Lingrong (Empresses in the Palace)Originally a friend of Zhen Huan, An Lingrong grows jealous and schemes against her due to family pressure to win the Yongzheng Emperor's favor and manipulation by other imperial consorts.ISFJ<img width="120px" height="auto" src="https://github.com/opendilab/PsyDI/blob/main/assets/anlingrong.PNG"></a>
Emperor and Empress (Empresses in the Palace)In the setting of the TV drama "The Legend of Zhen Huan," Emperor Yongzheng and the Empress were a young married couple, having tied the knot when Yongzheng was still the Prince of Yong. However, as time passed, their relationship became complex and tortuous.ESTJ/ISTJ<img width="120px" height="auto" src="https://github.com/opendilab/PsyDI/blob/main/assets/emperor.png"></a>
Rafayel (Love and Deep Space)Rafayel is one of the character in "Love and Deep Space," hailing from the oceanic civilization of Lemuria. He is a unique and gifted artist, embodying innocence and deep affection. Although he may appear stubborn and somewhat unapproachable at times, his heart is filled with a strong sense of responsibility and a profound regard for emotions.INFP<img width="120px" height="auto" src="https://github.com/opendilab/PsyDI/blob/main/assets/qiyu.png"></a>
Xavier (Love and Deep Space)Xavier is one of the male protagonists in "Love and Deep Space," currently serving as a Deep Space hunter for the Hunter Association. He exhibits extraordinary patience and a detached, Buddhist-like attitude towards life, interacting with the world in a gentle and peaceful manner while maintaining a moderate distance in interpersonal relationships.ISTP<img width="120px" height="auto" src="https://github.com/opendilab/PsyDI/blob/main/assets/shenxinghui.png"></a>
Sylus (Love and Deep Space)Sylus is one of the male protagonists in "Love and Deep Space." He is the highest-bounty criminal in the history of Pheros Star and the only one who has successfully escaped from the temporal prison. He demonstrates deep care and a strong sense of responsibility for important people with his firm leadership, decisive action, and thoughtful decision-making.ENTJ<img width="120px" height="auto" src="https://github.com/opendilab/PsyDI/blob/main/assets/qinche.png"></a>
Zayne (Love and Deep Space)Zayne is one of the male protagonists in "Love and Deep Space," a talented heart surgeon. He values solitude and self-reflection, facing challenges with calm analysis and strategic planning, showing deep care and a strong sense of responsibility for important people.INTJ<img width="120px" height="auto" src="https://github.com/opendilab/PsyDI/blob/main/assets/lishen.png"></a>
Sho Yamanaka (Haikyuu!!)Sho Yamanaka is the male protagonist in "Haikyuu!!," the setter of the Karasuno High School Volleyball Club. He infects others with his open and energetic nature, showing tenacious fighting spirit and adaptability, becoming a core in the team with warm support and encouragement, reflecting his emphasis on interpersonal relationships and love for life.ESFP<img width="120px" height="auto" src="https://github.com/opendilab/PsyDI/blob/main/assets/rixiang.png"></a>
Gojo Satoru (Jujutsu Kaisen)Gojo Satoru is a character in "Jujutsu Kaisen," a Special Grade Jujutsu Sorcerer. He communicates with others in a relaxed and humorous way, showing a proud light of wisdom, while demonstrating an indomitable fighting spirit and strategic thinking in the face of challenges. Although he shows calmness and calculation in battle, he shows deep care and support for his students and companions.ENTP<img width="120px" height="auto" src="https://github.com/opendilab/PsyDI/blob/main/assets/wutiaowu.png"></a>

Outline

:star_struck: Quick Start

Getting started with PsyDI is easy! Follow these simple steps to begin your journey of self-discovery:

:rocket: Accessing PsyDI Online: Visit our website to access PsyDI directly online. No downloads or installations required!

:memo: Beginning the Quiz:

<div align="center"> <img width="1000px" height="auto" src="https://github.com/opendilab/PsyDI/blob/main/assets/init_part_en.png"></a> </div>

:bulb: Exploring Your Personality:

:speech_balloon: Interactive Chatting:

<div align="center"> <img width="1000px" height="auto" src="https://github.com/opendilab/PsyDI/blob/main/assets/choose_part_en.png"></a> </div>

:sparkles: Detailed Analysis:

Now that you know the basics, dive in and start your journey with PsyDI today!

:key: PsyDI Mini Pipeline

We offer a mini version of the PsyDI pipeline as a demo, making it accessible for everyone to use. This mini pipeline allows users to input several initial posts and generates an initial MBTI score table. It then selects posts with the highest likelihood of having deep meaning to initiate a multi-turn dialogue with the user. After the dialogue, the pipeline updates the user's MBTI score table. Such mini pipeline is the core module of PsyDI as mentioned in the Introduction.

In this mini pipeline, we apply DeepSeek as a large language model example to provide multi-turn dialogue. Users can also replace it with any other language model with multi-turn dialogue capabilities.

Installation

pip3 install -r requirements.txt

Usage

Mini Pipeline with Our Released Score Model

REWARD_MODEL_PATH=<rm-path> API_KEY=<your-api-key> API_URL=https://api.deepseek.com MODEL_NAME=deepseek-chat python3 psydi_mini_agent.py

Mini Pipeline with Fake Debug Score Model

DEBUG=true API_KEY=<your-api-key> API_URL=https://api.deepseek.com MODEL_NAME=deepseek-chat python3 psydi_mini_agent.py

:books: Introduction

<div align="center"> <img width="1000px" height="auto" src="https://github.com/opendilab/PsyDI/blob/main/assets/psydi_pipeline.png"></a> </div> PsyDI operates on the principle that understanding a user's expressed thoughts involves delving deeper into the underlying cognitive processes. By uncovering these cognitive processes, PsyDI can identify the user's commonly used cognitive styles and ultimately determine their Myers-Briggs Type Indicator (MBTI).

Evaluation Framework

At the core of PsyDI's evaluation process is a table of MBTI scores, following established psychological testing methods. Each row of this table represents the probability of the current user being assigned to a specific MBTI type, ranging from 0 to 100.

Process Description

PsyDI first converts the user's multimodal information into text form. The score model then evaluates these textual expressions, providing probabilities for each sentence being associated with any MBTI type. PsyDI iterates through the following three steps until determining the user's MBTI:

  1. Post Selection: PsyDI selects the post with the highest scores under both of the two MBTI types with the Top-2 probabilities. This step aims to pinpoint the most ambiguous information and prompt further questions to clarify.

  2. Dialog Interaction: PsyDI engages the user in multiple rounds of dialog, utilizing three interaction formats: multiple choice, forced choice, and free question and answer. All the question and answer pairs are integrated into a new post.

  3. Table Update: PsyDI updates the MBTI score table with the new post, incorporating the insights gained from the dialog interaction.

Iterative Refinement

PsyDI iterates through these steps until it reaches a confident determination of the user's MBTI, continually refining its understanding through each interaction.

Evaluation

Score Model Evaluation

We have constructed a pair-wise MBTI dataset and compared the performance of multiple closed-source and open-source models with PsyDI on this dataset. PsyDI has demonstrated superior results over existing language models across various MBTI datasets, as shown in the following:

<div align="center"> <img width="1000px" height="auto" src="https://github.com/opendilab/PsyDI/blob/main/assets/benchmark.png"></a> </div>

Pipeline Evaluation

We assessed the accuracy of the PsyDI Pipeline compared to existing MBTI tests in evaluating MBTI bots, with the results displayed on the left side of the figure below. Additionally, we evaluated the degree of dependence of the PsyDI Pipeline on initial dynamics and found that PsyDI can determine the user's true MBTI in subsequent conversations even under random initial dynamics, with the results shown on the right side of the figure:

<div align="center"> <img width="1000px" height="auto" src="https://github.com/opendilab/PsyDI/blob/main/assets/rank_random.png"></a> </div>

Roadmap

Running Frontend Locally

You will first need to use the environment variables defined in .env.example to run PsyDI agent.

Note: You should not commit your .env file or it will expose secrets that will allow others to control access to your various OpenAI and authentication provider accounts.

Then you need to install node.js (v18.17.0 is recommended) and npm on your machine.

After setting up all the prerequisites, you can run the following commands to start the frontend:

npm install -g pnpm
pnpm install
pnpm dev --port 3001

Your app template should now be running on localhost:3001.

Acnowledgements

Feedback and Contribution

We appreciate all the feedbacks and contributions to improve PsyDI, both algorithms and system designs.

Citation

@article{li2024psydi,
    title={PsyDI: Towards a Personalized and Progressively In-depth Chatbot for Psychological Measurements},
    author={Li, Xueyan and Chen, Xinyan and Niu, Yazhe and Hu, Shuai and Liu, Yu},
    journal={arXiv preprint arXiv:2408.03337},
    year={2024}
}

License

PsyDI is released under the Apache 2.0 license.