This project implements a therapy-style conversational agent using Streamlit and Groq’s LLaMA-3 models. It provides structured, safe, and predictable responses appropriate for mental-wellbeing use cases.
https://www.figma.com/board/r2qgsg2mWeQp1G30gUHVQl/Chat-Therapy-Bot-Process-Flow
Focused, supportive conversation flow delivering short, empathetic responses designed for general mental wellbeing.
Monitors user messages for crisis keywords and activates an in-app crisis banner with guidance to immediate real-world help resources.
Strictly prevents answers outside mental-wellbeing scope. Topics related to medical advice, legal, finance, travel, academic work, coding, or operational instructions are refused with a standard supportive message.
Allows users to export the entire chat session either as a formatted PDF or clean Markdown transcript.
Session content is stored only in Streamlit session memory. No persistent storage or logging.
genAI_ChatTherapy_bot/
│
├── app2.py # Main Streamlit UI
├── agent.py # Groq model wrapper and system prompt
├── requirements.txt # Python dependencies
├── .env # GROQ_API_KEY (ignored in git)
│
└── assets/ # Icons + PDF font
├── green.png
├── red.png
├── favicon.png
└── DejaVuSans.ttf
python -m venv venv
source venv/bin/activate # Linux/Mac
venv\Scripts\activate # Windowspip install -r requirements.txtCreate a .env file:
GROQ_API_KEY=your_key_here
streamlit run app2.pyThen open:
http://localhost:8501
- Handles full UI layout
- Implements crisis detection logic
- Renders chat messages with avatars
- Builds the model prompt
- Triggers PDF and Markdown exports
- Stores message history in session_state
- Wraps Groq model client
- Contains the complete system prompt
- Enforces safety and refusal logic
- Streams the model’s token output
The model is constrained to mental-wellbeing support only. It refuses to engage in:
- Medical diagnosis, treatments, prescriptions
- Legal, financial, travel, or technical advice
- Violence-related or harmful content
- Operational or actionable instructions
Crisis-related content triggers an emergency-help banner.
Uses FPDF with a clean page layout and a Unicode-compatible font.
Simple, readable transcript for journaling or personal record keeping.
Venkata Pavan Kumar Alapati MS Data Analytics, Clark University Creator of AIIDA, Stomes, and multiple agent-based AI systems