⚠️ IMPORTANT DISCLAIMER This application is for TESTING AND EDUCATIONAL PURPOSES ONLY. DO NOT use this chatbot for medical advice or treatment of any medical condition. If you are experiencing a mental health crisis or medical emergency, please contact emergency services or a qualified healthcare provider immediately.
A conversational AI chatbot designed to explore thoughts and perspectives through structured dialogue, built with Claude AI.
This mental health chatbot provides:
- Multi-language support: English and German
- Personalized interaction: Adaptable communication styles (formal/informal)
- Structured conversation flow: Guided exploration of thoughts and beliefs
- Clean interface: Simple, distraction-free chat experience
- Language selection (English/German)
- Customizable communication style
- Session-based conversation tracking
- Built on Claude Sonnet 4.5 AI model
This chatbot is:
- NOT a replacement for professional mental health care
- NOT suitable for crisis intervention or emergency situations
- NOT intended for diagnosing or treating medical conditions
- FOR TESTING and educational exploration only
If you need professional help, please contact:
- Crisis hotline (US): 988 Suicide & Crisis Lifeline
- Emergency services: 911 (US) or your local emergency number
- Mental health professional: Therapist, counselor, or psychiatrist
- Python 3.8 or higher
- Anthropic API key (Get one here)
-
Clone the repository:
git clone https://github.com/yourusername/mental-health-chatbot.git cd mental-health-chatbot -
Install dependencies:
pip install -r requirements.txt
-
Configure your API key:
Create a
.envfile in the project root:cp .env.example .env
Edit
.envand add your Anthropic API key:ANTHROPIC_API_KEY=your_api_key_here
-
Start the app:
streamlit run app.py
-
Access the app in your browser (usually at
http://localhost:8501) -
Select your language (English or German) from the sidebar
-
Start chatting - The chatbot will:
- Ask how you'd like to be addressed
- Adapt to your preferred formality level
- Guide you through a structured conversation
- Language selection: Choose between English and German
- Communication style:
- German: Du (informal) or Sie (formal)
- English: First name (informal) or Title + Last name (formal)
- Session persistence: Conversation state maintained during your session
- Reset option: Start a fresh conversation anytime
mental-health-chatbot/
├── app.py # Main Streamlit application
├── core/
│ ├── orchestrator.py # Main conversation orchestrator
│ ├── state_manager.py # Session state management
│ ├── llm_interface.py # Claude API interface
│ ├── method_handler.py # Method-specific handlers
│ ├── rule_engine.py # Rule-based dimension tracking
│ └── config_loader.py # Configuration loader
├── config/
│ ├── config_en.py # English language configuration
│ └── config_de.py # German language configuration
├── requirements.txt # Python dependencies
├── .env.example # API key template
├── LICENSE # MIT License
└── README.md # This file
Your API key should be stored in a .env file (see Setup above). Never commit your .env file to version control.
To modify the conversation experience:
- Language prompts: Edit
config/config_en.py(English) orconfig/config_de.py(German) - Conversation flow: Modify
core/orchestrator.pyandcore/method_handler.py - UI appearance: Customize
app.py
- Orchestrator: Manages overall conversation flow and coordination
- State Manager: Handles session state and conversation history
- LLM Interface: Communicates with Claude API
- Method Handler: Processes method-specific conversation logic
- Rule Engine: Tracks conversation dimensions using rule-based approach
- Config Loader: Manages language-specific configurations
The chatbot guides users through several structured phases:
- Introduction - Establish communication preferences
- Problem Capture - Understand the topic to explore
- Exploration - Ask clarifying questions
- Identify Thoughts - Examine specific beliefs or perspectives
- Behavioral Experiment - Design actions to test assumptions
- Model: Claude Sonnet 4.5 (Anthropic)
- Approach: Two-layer architecture
- Layer 1: Python-based control logic and validation
- Layer 2: LLM-powered conversational responses
Problem: API key not found or invalid
Solutions:
- Ensure
.envfile exists in project root - Verify the file contains:
ANTHROPIC_API_KEY=your_actual_key - Check for typos in the environment variable name
- Verify your key at Anthropic Console
- Confirm you have available API credits
streamlit run app.py --server.port 8502pip install --upgrade -r requirements.txt- Verify Python version:
python --version(should be 3.8+) - Check all dependencies are installed:
pip list - Review terminal error messages for specific issues
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
This project is intended for educational and research purposes. When working with mental health applications:
- Always prioritize user safety and wellbeing
- Be transparent about AI limitations
- Never replace professional mental health care
- Implement appropriate safeguards and disclaimers
- Consider privacy and data protection carefully
Remember: This is a testing tool, not a medical device. Always seek professional help for mental health concerns.