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 Repos

Project Purpose:
Many people experience situations where they need to talk to someone—whether to unload emotional burdens or seek trusted advice. However, not everyone has consistent access to a trusted confidant. Data suggests this is a widespread issue.

Let the Data Speak:

Project Motivation:
This project was motivated by the common challenges individuals face when building and maintaining social connections, particularly in unfamiliar environments. Many people experience isolation, limited access to affordable mental health support, and long waitlists for institutional resources. In such contexts, conversational AI tools are often used as an accessible outlet for emotional expression and reflection. These tools can help users externalize thoughts, reduce emotional overload, and reframe situations more realistically.

However, several limitations were observed. Conversations often lacked continuity, requiring users to repeatedly reintroduce personal context. Early responses tended to be generic until sufficient background was provided. Despite these limitations, conversational AI interactions may still reduce immediate stress and prevent the accumulation of anxiety over time.

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 the user.

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 an individual will never get COVID. Similarly, this bot does not promise to completely eliminate loneliness and isolation. Just as the vaccine lowers the risk of severe complications, the goal of this project is to reduce levels of loneliness and isolation, potentially helping prevent loneliness-related suicides.

Challenges:

Key Accomplishments:

What Was Learned:

Future Vectors:

Demo: