Skip to content

Asdao/help4good

Repository files navigation

Help4Good

Status Python Streamlit

Help4Good is an interactive AI chatbot designed as a neutral second opinion to help caregivers and care recipients navigate emotional struggles and improve their relationship. By acting as a bridge for communication, it ensures care is provided in a mutually respectful, meaningful, and joyful way.

Problem Statement

Develop a solution that improve relationships between caregiver and the care recipient so that caregivers can provide the care that the care recipients want/need in a mutually respectful, meaningful, and joyful way?

  • Caregiver Uncertainty and Pride: Caregivers often struggle with a recipient's unique needs or may resist external advice due to the belief they already know what is best.
  • Recipient Loss of Autonomy: Recipients (typically individuals over 40 requiring daily assistance) often feel like a "managed" object rather than a person, leading to resistance and withheld emotions.
  • Hidden Struggles: Emotional issues often fester because they are not articulated, straining the bond between both parties.

How the Help4Good Chatbot Solves This

1. For the Care Recipient: A Safe Space for Expression

  • Judgment-Free Environment: It provides a safe, private space for recipients to express deeper emotional struggles they might not feel comfortable sharing directly with their caregiver.
  • Clarity and Articulation: The bot helps recipients process their feelings, enabling them to return to the caregiver with better clarity on what they actually need.

2. For the Caregiver: A Confidential Sounding Board

  • Reducing Mental Load: It serves as a confidential platform to work through difficult situations without the caregiver having to admit uncertainty to others.
  • Evidence-Based Guidance: The bot offers coaching using reflective listening, empathy, and evidence-based strategies to improve how caregivers approach difficult conversations.
  • Increased Confidence: By providing curated strategies, it helps caregivers feel more confident in their care decisions.

3. Intelligent & Continuous Support (Tech Features)

  • Contextual Memory: The bot refers to previous conversations to understand the care receiver's ongoing situation, saving time and ensuring continuous, accurate support.
  • Retrieval-Augmented Generation (RAG): Using RAG and curated datasets from HuggingFace, the bot provides informed conversation strategies rather than "guessing," which builds user trust.
  • Accessible Tech Stack: Built with a user-friendly Streamlit interface and powered by the Google GenAI SDK (Gemma), it offers a scalable way for seniors to live happily at home.
  • Safety First (Singapore Localized): Detects distress signals and suggests local crisis resources (Mindline, SOS, Care Hotline) when necessary.
  • Dual Interface: Includes both a rich Web UI (Streamlit) and a lightweight Terminal CLI.

Alignment with Holistic Well-being

Aligned with the philosophy of organizations like the Tsao Foundation, Help4Good ensures that aging is a positive experience rather than just a medical one. It focuses on the psychological and social health of both stakeholders, treating them with the respect and gratitude they deserve.


Project Structure

mental-health-bot/
├── app.py                  # Main Streamlit Web Application
├── main.py                 # Alternative CLI Chat Interface
├── chatbot.py              # Core Logic (RAG, Gemini Client, Memory)
├── ingest.py               # Script to build/update the knowledge base
├── memory.py               # Conversation History Manager
├── requirements.txt        # Project Dependencies
├── .env.example            # Template for environment variables
├── chroma_db/              # Local Vector Database (Created after ingestion)
└── ARCHITECTURE.md         # Detailed Technical Documentation

Getting Started

Prerequisites

  • Python 3.10 or higher.
  • Google Gemini API Key: Get one for free at Google AI Studio.

Installation

  1. Clone the Repository

    git clone https://github.com/yourusername/mental-health-bot.git
    cd mental-health-bot
  2. Create a Virtual Environment (Recommended)

    # Windows
    python -m venv venv
    .\venv\Scripts\activate
    
    # macOS/Linux
    python3 -m venv venv
    source venv/bin/activate
  3. Install Dependencies

    pip install -r requirements.txt
  4. Configure API Keys

    • Create a .env file in the root directory.
    • Add your Google API Key:
      GOOGLE_API_KEY=your_actual_api_key_here

Initialization

Before running the bot, you must build the vector database. This downloads the dataset and creates the embeddings.

python ingest.py

Wait for the "Ingestion complete" message.


Usage

Option 1: Web Interface (Recommended)

Start the Streamlit dashboard for the full experience.

streamlit run app.py
  • URL: Opens automatically at http://localhost:8501
  • Features: Real-time chat, downloadable history, sidebar controls.

Option 2: Terminal Mode

Run the lightweight CLI version for quick testing.

python main.py
  • Type your message and press Enter.
  • Type quit or exit to stop.

Troubleshooting

Issue Solution
"GOOGLE_API_KEY not found" Ensure you created .env and it contains GOOGLE_API_KEY=AIza....
"ModuleNotFoundError" Make sure you activated your virtual environment (venv).
"Chroma components invalid" Delete the chroma_db folder and run python ingest.py again to rebuild.
Slow Responses The first query might be slow as models load into memory. Subsequent queries will be faster.

Documentation

For a deep dive into how the RAG pipeline and memory system works, please read ARCHITECTURE.md.

Disclaimer

This is an AI prototype, not a doctor. It is not designed to handle life-threatening emergencies. If you or someone you know is in immediate danger, please call emergency services (999/995 in SG) or a suicide hotline immediately.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages