- Research shows that individuals with neurodiverse conditions (e.g., ADHD, autism) often struggle with self-compassion (Beaton et al., 2002). Everyday reminders to be kind to oneself can be cognitively demanding and difficult to sustain, especially during stressful situations or when executive function is taxed. This project addresses that gap by offering a lightweight and accessible tool to make self-compassion easier and less effortful. Drawing from leading evidence-based research, this app provides a structured and easy way to practice kindness toward oneself β₯.
videowalkthrough.webm
-
Science-based: built using leading empirical research and science on neurodiversity and self-compassion.
-
Interactive Web Interface: easy-to-use Streamlit app with fast, instant responses (press 'Enter' or click 'Answer').
-
Smart Search Options: choose between
hybrid,BM25, orvectorretrieval to find the most relevant guidance. -
Personalized Experience (LLM Evaluation): select from 3 prompt styles based on your moods and needs-- π Supportive, π Direct, or πͺπ» Action-Oriented!
| Prompt Style | Purpose | Example Response Tone |
|---|---|---|
| π Supportive | Compassionate, reflective guidance | "It's completely understandable that you're feeling this way..." |
| π Direct | Concise, factual information | "Here are three evidence-based strategies for..." |
| πͺπ» Action-Oriented | Practical steps and exercises | "Try this 5-minute exercise: First, notice..." |
- Advanced Customization: adjust search depth (top-k results), LLM creativity (temperature), and choose between GPT models (gpt-4o-mini or gpt-3.5-turbo).
- Enhanced Retrieval: optional query expansion and document re-ranking for better, more relevant results.
- Built-in Analytics: Real-time feedback collection and monitoring dashboards to track usage and effectiveness.
- Python version: Python 3.11+ recommended
- Environment variables:
OPENAI_API_KEY(required for LLM features; set in a.envfile or your environment).
-
Clone the repo and install dependencies:
git clone https://github.com/<your-username>/selfcompassion-llm.git cd selfcompassion-llm pip install -r requirements.txt
-
Run ingestion to build the index:
python ingestion.py
-
Launch the Streamlit app:
streamlit run streamlit_app.py
- Set up API key. Create a
.envfile in project root:OPENAI_API_KEY=your_actual_api_key_here
- Run docker:
docker-compose up -- build
- Access at http://localhost:8503
selfcompassion-llm/
βββ streamlit_app.py # main Streamlit app
βββ ingestion.py # build FAISS/embedding index
βββ monitor.py # simple monitoring dashboard
βββ docker-compose.yml # docker setup
βββ Dockerfile
βββ Makefile # developer shortcuts
βββ processed_documents_clean.json # demo dataset
βββ requirements.txt
βββ images # images folder
βββ notebooks/ # exploration notebook with example code
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β USER INTERFACE β
β Streamlit Web App β
β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β Query β β Settings β β Feedback β β
β β Input β β Panel β β Radio β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β QUERY PROCESSING β
β β
β βββββββββββββββ βββββββββββββββ β
β β Query ββββββββββΆβ Original β β
β β Rewriting β β Query β β
β βββββββββββββββ βββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β RETRIEVAL LAYER β
β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β BM25 β β Vector β β Hybrid β β
β β Search β β Search β β Search β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β β
β βΌ β
β βββββββββββββββββββ β
β β Document β β
β β Re-ranking β β
β βββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β KNOWLEDGE BASE β
β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β Documents β β Embeddings β β BM25 Index β β
β β JSON β β .npy β β Memory β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β LLM GENERATION β
β β
β βββββββββββββββ βββββββββββββββ β
β β OpenAI βββββββββββ Prompt β β
β β gpt-4o-miniβ β Engineering β β
β βββββββββββββββ βββββββββββββββ β
β β β
β βββββββββββββββ β β
β β 3 Prompt ββββββββββββββββ β
β β Styles β β
β βββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MONITORING & LOGGING β
β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β Event Log β β Feedback β β Dashboard β β
β β JSONL β β Collection β β Charts β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- User Input β Query entered in Streamlit interface
- Query Processing β Optional rewriting with domain terms
- Retrieval β Multiple search methods (BM25/Vector/Hybrid)
- Re-ranking β Document relevance scoring
- Context Building β Top documents formatted for LLM
- Generation β OpenAI API with custom prompts
- Response β Answer + sources displayed to user
- Monitoring β Events logged for analytics
- Run it with:
streamlit run monitor.py
- A separate monitoring page (
monitor.py) tracks:- Sources per answer
- Feedback breakdown
- Query rewriting usage
python evaluation.py- App is deployed and running here.
- The Self-Compassion RAG system was evaluated on a golden dataset of 20 queries with labeled relevant documents. It tests the RAG system against the golden dataset.
| Retrieval Method | Hit Rate | MRR | Precision@10 | Recall@10 |
|---|---|---|---|---|
| BM25 | 1.000 | 0.598 | 0.100 | 1.000 |
| Vector | 0.900 | 0.410 | 0.090 | 0.900 |
| TF-IDF | 0.900 | 0.410 | 0.090 | 0.900 |
| Hybrid | 0.950 | 0.520 | 0.095 | 0.950 |
Multiple prompt styles tested and compared:
- π Supportive, π Direct, πͺπ» Action-Oriented prompts
- Each optimized for different query types
- User feedback collected to assess effectiveness
Multiple models evaluated:
- gpt-4o-mini (primary) vs gpt-3.5-turbo
- Performance tested across all retrieval methods
- BM25 consistently achieves perfect hit rate and recall in this dataset, with the best MRR (0.598), ranking relevant documents higher.
- Hybrid slightly improves over pure TF-IDF and Vector, balancing precision and recall.
- Vector and TF-IDF show similar performance, with lower MRR than BM25 but decent recall.
- BM25 emerges as the most reliable retriever under current conditions, though Hybrid provides a good balance.
-
Deterministic ingestion pipeline (
ingestion.py) -
requirements.txtprovided for environment setup -
Docker + docker-compose included for containerized runs
-
Repo includes a small demo dataset (
processed_documents_clean.json) to immediately run the app and test its functionality. -
To rebuild the larger embedding index files locally, run:
make ingest
or
python ingestion.py
- Exploration notebooks are under
/notebooks/. - Embeddings (
embeddings.npy,id_index.json) are ignored from git. - Feedback data is stored locally (not shared).
- All data sources are carefully curated from peer-reviewed research, legally purchased books (excerpts only, fair use), and publicly available expert materials (e.g., podcast transcripts).
- Full PDF sources are maintained in a separate private repository for copyright compliance.
- All responses are anonymous β nothing is saved, logged, or tracked by the app.
- This app does not store, share, or distribute full PDFs or copyrighted materials. All content is based on short excerpts, summaries, or personal notes, either from books Iβve legally purchased or from publily available sources (e.g., peer-reviewed articles, podcast transcripts).
- This app is intended for educational and personal use only. It is not intended to diagnose, treat, cure, or prevent any mental health condition. If you are in emotional distress or experiencing a crisis, please contact a licensed mental health professional.
β₯ Thank you so much for using the app-- I hope you find it useful! May we all be kind to ourselves! πππ»
- This project is licensed under the MIT License








