VinhAlth/chatbot-mental-checkin

An AI chatbot leveraging LLM and NLP techniques to assess mental health through a conversation based on the 9 PHQ-9 questions, providing empathetic, privacy-focused interactions and evaluations based on user responses’ scores

Python

2

15 commits

updated May 24, 2025

See the code

README

🧠 AI Mental Health Support Chatbot

A conversational AI system designed to assist with preliminary psychological assessments, mental health screening, and personalized well-being support.
Built using Vistral 7B, this chatbot delivers a safe, empathetic, and structured dialogue experience.


🎬 Demo

Chatbot Demo


🧾 Project Overview

This chatbot guides users through the PHQ-9 questionnaire, a standard clinical tool for assessing depression severity. It simulates an empathetic conversation that ensures emotional safety, privacy, and clarity for the user. The chatbot:

  • βœ… Asks 9 PHQ-9 questions conversationally
  • βœ… Responds supportively to each answer
  • βœ… Calculates score internally (not visible to user)
  • βœ… Summarizes findings with tailored suggestions
  • βœ… Encourages professional support when necessary

🌟 Key Features

  • πŸ’¬ Empathe powered by Vistral 7B and modern
  • 🧠 Validated Psychological Framework (PHQ-9 logic)
  • πŸ” Private Scoring with no exposure of sensitive data
  • πŸͺ· Wellness Suggestions (e.g., mindfulness, journaling, jogging)
  • 🚨 Professional Referral for high-risk cases
  • πŸ–₯️ User-friendly frontend for easy self-check-in

πŸ’‘ Use Cases

  • πŸ§‘β€πŸŽ“ Students in need of periodic mental wellness check-ins
  • 🏒 Employees accessing corporate mental health support systems
  • 🧘 Individuals seeking self-guided mental health reflection or early detection
  • 🏫 Schools & Universities offering proactive support to learners

βš™οΈ Tech Stack

ComponentTechnology
Language ModelVistral-7B-Chat
BackendPython, FastAPI
FrontendHtml, Css

πŸš€ Quick Start

git clone https://github.com/VinhAlth/chatbot-mental-checkin.git
cd chatbot-mental-checkin
pip install -r requirements.txt
python main.py

Open your browser and visit: http://localhost:8000


πŸ“ Project Structure

your_project/
β”œβ”€β”€ data copy/                     # Temporary folder for copied or backup data
β”œβ”€β”€ logs/                          # Stores application logs (e.g., user sessions, errors)
β”œβ”€β”€ result/run                     # Stores model output for each run (e.g., result_001.json)
β”œβ”€β”€ src/                           # Main source code for the system (logic, AI, processing)
β”‚   β”œβ”€β”€ __init__.py               
β”‚   β”œβ”€β”€ executive.py               # Controls and coordinates chatbot conversation flow
β”‚   β”œβ”€β”€ predict.py                 # Manage real-time conversation and save results to CSV
β”‚   β”œβ”€β”€ prompts.py                 # Contains prompts for the LLM (e.g., VistralChatbot), PHQ-9 questions
β”‚   β”œβ”€β”€ utils.py                   # Utility functions for model loading, conversation handling, etc.
β”‚   └── end.py                     # Calculates and evaluates scores at the end of a test
β”œβ”€β”€ static/                        # Static files (CSS, JS, images) for the web interface
β”œβ”€β”€ templates/                     # HTML templates 
β”œβ”€β”€ .gitignore                     
β”œβ”€β”€ analyse.py                      # Analyzes user results after completing the questionnaire
β”œβ”€β”€ main.py                        # Entry point to run the Flask web application
β”œβ”€β”€ patient_infor.txt              # Temporary storage for patient information during a session
β”œβ”€β”€ predict.py                     # Process data from CSV, predict, and save to CSV
β”œβ”€β”€ readme.md                      # Project documentation (overview, setup, usage)
└── requirement.txt                # List of required Python packages (install via `pip install -r`)


Sample Conversation

πŸ‘€ User: I don’t feel interested in anything these days. πŸ€– Chatbot: I’m really sorry you’re feeling that way. It’s okay to feel overwhelmed. Could you tell me how often you've felt like this over the last 2 weeks?

πŸ‘€ User: Almost every day. πŸ€– Chatbot: Thank you for your honesty. That sounds difficult. I'm here to help you explore how you're feeling, one step at a time.

(… continues through 9 questions)

πŸ€– Chatbot (Final): Based on your responses, it might help to try daily mindfulness or reach out to a trusted person. If this feeling persists, I recommend talking to a mental health professional. You’re not alone, and support is available πŸ’™


βœ… Ethics & Safety

  • πŸ“‹ Based on validated psychological instruments (PHQ-9)
  • 🧠 Includes well-being-first design for interaction safety
  • πŸ” All data is anonymized, not stored by default

⚠️ Disclaimer: This chatbot is a research prototype and does not offer professional medical advice. If you're experiencing a mental health crisis, please contact a licensed therapist or local emergency services.

VinhAlth/chatbot-mental-checkin

An AI chatbot leveraging LLM and NLP techniques to assess mental health through a conversation based on the 9 PHQ-9 questions, providing empathetic, privacy-focused interactions and evaluations based on user responses’ scores

Python

2

15 commits

updated May 24, 2025

See the code

README

🧠 AI Mental Health Support Chatbot

A conversational AI system designed to assist with preliminary psychological assessments, mental health screening, and personalized well-being support.
Built using Vistral 7B, this chatbot delivers a safe, empathetic, and structured dialogue experience.


🎬 Demo

Chatbot Demo


🧾 Project Overview

This chatbot guides users through the PHQ-9 questionnaire, a standard clinical tool for assessing depression severity. It simulates an empathetic conversation that ensures emotional safety, privacy, and clarity for the user. The chatbot:

  • βœ… Asks 9 PHQ-9 questions conversationally
  • βœ… Responds supportively to each answer
  • βœ… Calculates score internally (not visible to user)
  • βœ… Summarizes findings with tailored suggestions
  • βœ… Encourages professional support when necessary

🌟 Key Features

  • πŸ’¬ Empathe powered by Vistral 7B and modern
  • 🧠 Validated Psychological Framework (PHQ-9 logic)
  • πŸ” Private Scoring with no exposure of sensitive data
  • πŸͺ· Wellness Suggestions (e.g., mindfulness, journaling, jogging)
  • 🚨 Professional Referral for high-risk cases
  • πŸ–₯️ User-friendly frontend for easy self-check-in

πŸ’‘ Use Cases

  • πŸ§‘β€πŸŽ“ Students in need of periodic mental wellness check-ins
  • 🏒 Employees accessing corporate mental health support systems
  • 🧘 Individuals seeking self-guided mental health reflection or early detection
  • 🏫 Schools & Universities offering proactive support to learners

βš™οΈ Tech Stack

ComponentTechnology
Language ModelVistral-7B-Chat
BackendPython, FastAPI
FrontendHtml, Css

πŸš€ Quick Start

git clone https://github.com/VinhAlth/chatbot-mental-checkin.git
cd chatbot-mental-checkin
pip install -r requirements.txt
python main.py

Open your browser and visit: http://localhost:8000


πŸ“ Project Structure

your_project/
β”œβ”€β”€ data copy/                     # Temporary folder for copied or backup data
β”œβ”€β”€ logs/                          # Stores application logs (e.g., user sessions, errors)
β”œβ”€β”€ result/run                     # Stores model output for each run (e.g., result_001.json)
β”œβ”€β”€ src/                           # Main source code for the system (logic, AI, processing)
β”‚   β”œβ”€β”€ __init__.py               
β”‚   β”œβ”€β”€ executive.py               # Controls and coordinates chatbot conversation flow
β”‚   β”œβ”€β”€ predict.py                 # Manage real-time conversation and save results to CSV
β”‚   β”œβ”€β”€ prompts.py                 # Contains prompts for the LLM (e.g., VistralChatbot), PHQ-9 questions
β”‚   β”œβ”€β”€ utils.py                   # Utility functions for model loading, conversation handling, etc.
β”‚   └── end.py                     # Calculates and evaluates scores at the end of a test
β”œβ”€β”€ static/                        # Static files (CSS, JS, images) for the web interface
β”œβ”€β”€ templates/                     # HTML templates 
β”œβ”€β”€ .gitignore                     
β”œβ”€β”€ analyse.py                      # Analyzes user results after completing the questionnaire
β”œβ”€β”€ main.py                        # Entry point to run the Flask web application
β”œβ”€β”€ patient_infor.txt              # Temporary storage for patient information during a session
β”œβ”€β”€ predict.py                     # Process data from CSV, predict, and save to CSV
β”œβ”€β”€ readme.md                      # Project documentation (overview, setup, usage)
└── requirement.txt                # List of required Python packages (install via `pip install -r`)


Sample Conversation

πŸ‘€ User: I don’t feel interested in anything these days. πŸ€– Chatbot: I’m really sorry you’re feeling that way. It’s okay to feel overwhelmed. Could you tell me how often you've felt like this over the last 2 weeks?

πŸ‘€ User: Almost every day. πŸ€– Chatbot: Thank you for your honesty. That sounds difficult. I'm here to help you explore how you're feeling, one step at a time.

(… continues through 9 questions)

πŸ€– Chatbot (Final): Based on your responses, it might help to try daily mindfulness or reach out to a trusted person. If this feeling persists, I recommend talking to a mental health professional. You’re not alone, and support is available πŸ’™


βœ… Ethics & Safety

  • πŸ“‹ Based on validated psychological instruments (PHQ-9)
  • 🧠 Includes well-being-first design for interaction safety
  • πŸ” All data is anonymized, not stored by default

⚠️ Disclaimer: This chatbot is a research prototype and does not offer professional medical advice. If you're experiencing a mental health crisis, please contact a licensed therapist or local emergency services.