How deepthi01-a/mental_health_chatbot works
This notebook-style script builds a PDF-grounded mental-health chatbot. Its primary workflow initializes a Groq language model, ingests PDFs from ./data into a persistent Chroma vector store (or loads an existing store), constructs retrieval-based question answering, and serves responses through a Gradio chat UI. The same file also includes a separate terminal chat loop. The graph reflects the sampled source; no separate safety, crisis-response, or clinical-care subsystem is implemented here.
Main entry points: mental_health_chatbot.py Retrieval QA chain
Components 12
Knowledge ingestion
- PDF documents
- PDF loading and splitting
mental_health_chatbot.py - Text embeddings
mental_health_chatbot.py - Chroma vector store
mental_health_chatbot.py
Answer generation
- App initialization
mental_health_chatbot.py - Retrieval QA chain
mental_health_chatbot.py - Compassionate prompt
mental_health_chatbot.py - Groq language model
mental_health_chatbot.py
Chat interfaces
- Gradio UI
mental_health_chatbot.py - Chat response handler
mental_health_chatbot.py - Terminal chat loop
mental_health_chatbot.py
Other components
- Chat user
Connections 16
- Chat user → Gradio UI: sends message
mental_health_chatbot.py - Gradio UI → Chat response handler: invokes
mental_health_chatbot.py - Chat response handler → Retrieval QA chain: queries
mental_health_chatbot.py - Retrieval QA chain → Chat response handler: returns answer
mental_health_chatbot.py - Chat user → Terminal chat loop: enters query
mental_health_chatbot.py - Terminal chat loop → Retrieval QA chain: queries
mental_health_chatbot.py - App initialization → Groq language model: initializes
mental_health_chatbot.py - App initialization → Chroma vector store: loads or creates
mental_health_chatbot.py - App initialization → Retrieval QA chain: configures
mental_health_chatbot.py - PDF documents → PDF loading and splitting: provides PDFs
mental_health_chatbot.py - PDF loading and splitting → Text embeddings: embeds chunks
mental_health_chatbot.py - PDF loading and splitting → Chroma vector store: stores chunks
mental_health_chatbot.py - Text embeddings → Chroma vector store: indexes vectors
mental_health_chatbot.py - Retrieval QA chain → Chroma vector store: retrieves context
mental_health_chatbot.py - Retrieval QA chain → Compassionate prompt: formats context
mental_health_chatbot.py - Retrieval QA chain → Groq language model: invokes model
mental_health_chatbot.py