Skip to content

AnasRizwan25/Samsung_AI_Social_Anxiety_Chatbot_Group_Project_01

Repository files navigation

MindEase AI Assistant

MindEase is a domain-focused chatbot for social anxiety support. It uses retrieval-augmented generation (RAG) over your local document knowledge base, supports text/voice/document inputs, and logs real runtime analytics for evaluation.

Features

  • Social-anxiety-focused responses with scope filtering
  • RAG pipeline using FAISS vector search
  • Multimodal input support:
    • Text
    • Voice
    • Document upload (.pdf, .txt, .md)
  • Language response policy:
    • English
    • Urdu script
    • Roman Urdu
  • Real-run analytics logging and report chart generation

Tech Stack

  • Backend: FastAPI
  • AI/RAG: LangChain, FAISS, NVIDIA Embeddings, NVIDIA Chat model
  • Frontend: HTML, CSS, JavaScript
  • Reporting: Python + Matplotlib

Project Structure

.
├── web_app.py                      # Main FastAPI app (active backend)
├── chatbot_ai.py                   # Core AI logic (retrieval, generation, scope/language control)
├── ingest_database.py              # Build FAISS index from PDFs in data/
├── calculate_accuracy_report.py    # Accuracy summary from real analytics logs
├── generate_report_graphs.py       # Real-data graph generation for reports
├── requirements.txt
├── templates/
│   └── index.html                  # Main UI template
├── static/
│   ├── css/style.css               # Active stylesheet used by template
│   ├── js/script.js                # Active frontend logic used by template
│   ├── style.css                   # Legacy stylesheet copy
│   └── script.js                   # Legacy script copy
├── data/
│   └── *.pdf                       # Source knowledge documents
├── faiss_index/
│   ├── index.faiss                 # Vector index file
│   └── index.pkl                   # Index metadata/docstore
├── analytics/
│   └── chat_metrics.csv            # Runtime metrics log (auto-generated)
└── report_graphs/
    ├── grouped_bar_response_time.png
    ├── histogram_response_time.png
    └── evaluation_dataset.csv

Prerequisites

  • Python 3.10+ (Windows commands below assume py launcher)
  • NVIDIA API key for model and embeddings

Setup

  1. Create and activate virtual environment
py -m venv venv
.\venv\Scripts\Activate.ps1
  1. Install dependencies
pip install -r requirements.txt
  1. Create .env file in project root
NVIDIA_API_KEY=your_api_key_here
CHAT_MODEL=meta/llama-3.1-8b-instruct
  1. Add your social-anxiety-related PDFs into data/

  2. Build vector index

py .\ingest_database.py

Run the App

py .\web_app.py

Open:

How Runtime Flow Works

  1. User sends text/voice/document input from web UI.
  2. Backend validates input and session context.
  3. For document uploads:
    • Text extraction
    • Social-anxiety scope check
    • Out-of-scope docs are rejected with an outside-knowledge message
  4. Query is processed with retrieval from FAISS.
  5. LLM generates response with language policy.
  6. Metrics are logged to analytics/chat_metrics.csv.

Analytics and Reporting

Accuracy summary

py .\calculate_accuracy_report.py

Output includes:

  • Total logged chats
  • Overall mean accuracy
  • Median accuracy
  • Accuracy by input type

Report graphs from real run data

py .\generate_report_graphs.py

Generated files:

  • report_graphs/grouped_bar_response_time.png
  • report_graphs/histogram_response_time.png
  • report_graphs/evaluation_dataset.csv

Notes

  • Active frontend files are static/js/script.js and static/css/style.css.
  • chatbot.py exists as an alternate/legacy path; primary runtime is web_app.py + chatbot_ai.py.

Troubleshooting

  • "FAISS index not found": run py .\ingest_database.py first.
  • Missing API key error: verify .env contains NVIDIA_API_KEY.
  • Empty analytics/graph errors: run some chats first, then run reporting scripts.

About

MindEase is a domain-focused chatbot for social anxiety support. It uses retrieval-augmented generation over your local document knowledge base, supports text/voice/document inputs, and logs real runtime analytics for evaluation.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors