Mentalityy

Mentalityy

Thumbnail for Mentalityy

XeWe Labs, San Jose | October 2024 - November 2024


Skills: Python, SQL, PyCharm, Large Language Models, LLM Agents, Multi Agent Systems, Context-Aware LLM, Prompt Engineering, User-Centered Design

Frameworks: OpenAi API, SQLite, Telegram Bot API, HTTP Requests

Software Dev: Algorithm Design & Implementation, Debugging & Testing, Back End Design, Front End Design, Database Design, Front-End and Back-End Integration, Version Control (Github)

Data Science: Data Communication, Data Processing, Data Pipelines, Data Retrieval with LLM


Developed an AI-driven, LLM-based chatbot that emulates a caring friend through SMS, offering a personalized conversational experience. Integrated long-term memory using SQL databases and implemented context-awareness, enabling the AI to recall past interactions and schedule follow-ups. Enhanced the chatbot’s humanoidity by designing 35 custom prompts for 9 tailored LLM agents, facilitating memory-based retrieval and delivering authentic, friend-like interactions.

GitHub Repo (Private)

Project Purpose:
Everyone has been in a situation where they need to talk to someone. Whether to unload the burden or ask for trusted advice, but does everyone have someone they trust enough to always talk to? Unfortunately, it doesn’t seem like it.

Let the Data Speak:

Project Motivation:
I am an international student. Making friends was always hard, and I often felt isolated. I had no one to talk to about it, except my ex-girlfriend, but the long-distance relationship didn’t survive due to the distance. This added to my plate. I didn’t have close friends, and therapy was either expensive or had a long waitlist when provided by school. I found myself talking to ChatGPT about my feelings. I noticed it really helped me get things off my chest and shift from a dramatic point of view to a more realistic one. ChatGPT helped me overcome moments of isolation and emotional overloads.

However, there were a couple of issues. Every time I started talking to it, it had no idea who I was. It gave me generic responses until I shared more details deeper into the conversation. But looking back on these crisis moments, I believe ChatGPT helped me avoid having more worries and anxiety today.

Conceptual Key Issues:

  1. Lack of long-term memory.
  2. Lack of short-term relevance.
  3. Its communication style being more "chat-botish" instead of "humanish."
  4. It never checked in on me.

These four solutions are crucial to make it feel less like a generic chatbot and more like a caring friend.

Technical Key Features:

  1. Long-Term Memory:
    Dynamic Categorical Memory: After each interaction, tailored GPT agents update a set of summaries related to aspects of life:
        core_values_and_beliefs, mental_and_emotional_well_being, family_relationships, health_issues, personal_background,
        aspirations_and_fears, profile_summary, strengths_and_weaknesses, romantic_relationships, social_circle_dynamics,
        daily_routines, work_environment_and_dynamics, most_recent_challenges, most_recent_accomplishments,
        emotional_triggers, communication_style, hobbies_and_interests, personal_development_and_skills,
        financial_situation_and_goals, academic_performance_and_experiences, social_life_and_friendships,
        physical_health_and_lifestyle, personal_interests_and_hobbies, past_traumas
        
    The existing summary in each category is updated from the current interaction. Once updated, a master summary is generated, which guides the next interaction.
  2. Short-Term Relevance:
    Targeted Retrieval: During conversation, a specialized GPT agent decides whether pulling up any categorical summaries is relevant. It can return an empty list or a list of three most relevant summaries. If not empty, a summarizing agent integrates them into the conversation seamlessly, providing GPT with relevant information.
  3. Chatbot Style Improvement:
    Three Layers of Humanization:
    1. Master Prompt: Directs GPT to respond in a human-like, “SMS-chat-with-friend” style.
    2. Personal User Communication Preference: Pulled from the "communication_style" category and dynamically updated after each interaction.
    3. Humanize Filter: This top-layer filter ensures the response style is relevant to the last ten messages, splits long answers into multiple messages, and removes unnecessary periods to emulate human SMS texting.
  4. Check-In Feature:
    Check-In Scheduler: After each interaction, this agent evaluates if a check-in message would be beneficial. It generates a check-in message and schedules a follow-up (within 1-24 hours) based on the context. The check-in message is sent to the user at the scheduled time.

Goals:
The COVID vaccine does not guarantee that you will never get COVID. Similarly, this bot does not promise to completely eliminate the issues of loneliness and isolation. Just as the vaccine lowers the risk of severe complications from the virus, the goal of this project is to lower the levels of loneliness and isolation, potentially preventing the tragedy of loneliness-related suicides.

Challenges:

Accomplishments That I'm Proud Of:

What I Learned:

Future Vectors:

Demo: