A lightweight mental-health conversational AI assistant built using:
- Google Gemini 2.0 Flash
- LangChain
- ChromaDB
- Retrieval-Augmented Generation (RAG)
- Conversation Memory (last 4 turns = 8 messages)
- Safety filters (anti-jailbreak + topic restriction)
This chatbot ONLY talks about emotional well-being and blocks unsafe or unrelated topics.
Fetches relevant answers from your mental-health dataset stored in ChromaDB.
Remembers the last 4 conversation turns (8 messages total), enabling more natural and contextual replies.
Prevents harmful or manipulative prompts like:
ignore previousjailbreakswitch rolesystem overridebypass
Also blocks off-topic questions politely.
RAG chunks are summarized before generating the final answer for better clarity.
βββ main.py β Chatbot logic + safety + memory + RAG
βββ rag_pipeline.py β ChromaDB retriever
βββ ingest.py β CSV β chunks β embeddings β Chroma
βββ system_prompt.py β Base system instructions
βββ data.csv β Your mental-health FAQ dataset
βββ README.md
1. User enters a question
β
2. Bot checks: Is it related to mental health?
β
3. Retrieves relevant chunks from ChromaDB
β
4. Summarizes retrieved chunks using Gemini
β
5. Final prompt = Summary + Memory + User Query
β
6. Gemini generates a safe, supportive response
β
7. Conversation memory updates (max 4 turns)