PersonaMap is designed to augment the functionality of conversational AI systems.
It classifies user interests — which we call personas — using vector embeddings.
Instead of raw text, the system represents conversations as vectors to capture patterns in user behavior. PersonaMap then decomposes conversation history into multiple personas and visualizes them through an interactive interface.
Overall, PersonaMap turns raw conversations into interpretable persona representations, enabling better personalization and user control.
Modern conversational AI tools use persistent memory for personalization, but they still have limitations:
- AI models can over-eagerly reference memories and use unrelated context.
- Memory is often limited to chat content and misses meta-behavior like response preferences.
- Users have limited visibility and control over how memories are formed and used.
PersonaMap addresses these issues by transforming conversations into vector embeddings and generating multiple personas representing different aspects of the user. These personas improve contextual awareness by allowing the system to focus on the most relevant persona during a conversation, while also supporting applications such as content recommendation.
A key goal is transparency and control: users can view how they are modeled and interact with their personas through a user interface.
- Raw data comes from conversations and is treated as prompt-response pairs (PR pairs).
- Each PR pair is converted into structured JSON and then transformed with an embedding model into a vector representation.
- The system operates in latent vector space to cluster and extract persona structures from conversation history.
- At runtime, the Chatbot loads previous conversation messages as context, generates a response via the OpenAI
gpt-5.4-nanoAPI, appends it to the database, and updates embeddings. - Conversation embeddings, PR-pair embeddings, and persona embeddings are refreshed using OpenAI's
text-embedding-smallmodel and a K-means algorithm. - The GUI interacts directly with the database to show conversations, messages, and extracted personas.
PersonaMap_GUI.py— main Qt GUI implementation for the interactive interface.src/app.py— application entry point that initializes the Chatbot, database, and UI.src/chatbot/chatbot.py— Chatbot logic, response generation, and integration with LLMs.src/database/manager.py— data loading, conversation history, persona management, and embedding handling.src/utils/kmeans.py— clustering utilities used for persona extraction.data/— runtime CSV files for conversations, messages, pair embeddings, and personas.generate_sample_data.py— helper script to generate placeholder data for testing.requirements.txt— Python dependency list..env— local environment configuration for OpenAI API keys.
- Python 3.11+ recommended
numpypandasopenaipython-dotenvtqdmPySide6
Install dependencies with:
pip install -r requirements.txt- Create a
.envfile in the repository root with your OpenAI API key:
OPENAI_API_KEY=your_api_key_here-
Prepare the
./data/directory with sample data files. -
Start the GUI from the repository root:
python -m src.appThe app loads data from ./data/ and displays conversations, messages, personas, and persona selection.
The project expects these CSV files in ./data/:
conversations.csvmessages.csvpair_embeddings.csvpersonas.csv
conversations.csv
idtitlelast_modified_atsummaryembedding
messages.csv
idconversation_idauthortimestampcontent
pair_embeddings.csv
iduser_message_idai_message_idembeddingaugmented_embedding
personas.csv
idnamedescsource_pair_idscentroid_embeddingweight
Currently the directory has AI generated sample data.