Subash Kumar Yadav
HomeAboutProjectsBlogContact

Subash Kumar Yadav

Full-stack developer building web and mobile products that are useful, reliable, and thoughtfully designed.

Explore

  • Projects
  • Blog
  • About
  • Contact

Connect

  • GitHub
  • DAKSHA
  • subash67335@gmail.com
  • LinkedIn
© 2026–present Subash Kumar Yadav. Built with Next.js and thoughtful product design.
Back to projects

Case study

SevaBot

Backend/APIIn development

A Nepali legal research assistant that combines a Django backend, vector search, and a chat interface for grounded question answering.

Repository

Problem

Users needed a way to ask legally relevant questions in Nepali while keeping evidence grounded in trusted source material and isolated per-conversation document retrieval.

My implementation

Implemented the backend + retrieval pipeline, conversation flow, and document management structure for a RAG-based legal assistant.

Core features

  • Per-conversation PDF uploads with isolated retrieval
  • Permanent legal knowledge base plus user-uploaded context
  • Grounded answer generation with source attribution
  • Conversation editing, deletion, and chat management
  • Dark/light UI and Nepali Romanized typing support

Stack

DjangoPythonChromaDBReactViteTailwind CSSGROQRAG

Use cases & project notes

SevaBot – Nepali Legal RAG Chatbot

A full-stack Retrieval-Augmented Generation (RAG) chatbot for Nepali legal research. The backend is Django REST + ChromaDB, the frontend is Vite/React with Tailwind. Users can start conversations, upload per-conversation PDFs, and get grounded answers with source file badges.

Features

  • Per-conversation temporary document uploads (PDF) with isolated retrieval.
  • Permanent knowledge base in ChromaDB (legal codes) + user-uploaded collections.
  • Source chips show which PDF (permanent vs user) contributed to each answer.
  • Message editing with regenerated answers and preserved sources.
  • Dark/light toggle, Romanized Nepali typing, conversation management.

Prerequisites

  • Python 3.12+
  • Node.js 18+ (for frontend)
  • A virtual environment tool (venv recommended)
  • GROQ API key (for LLaMA-3.3 model), set as GROQ_API_KEY

Backend Setup

  1. Clone & enter project
    git clone <repo-url>
    cd SevaBot-A-RAG-based-nepali-chatbot
    
  2. Create & activate venv
    python3 -m venv venv
    source venv/bin/activate
    
  3. Install dependencies
    pip install -r requirements.txt
    
  4. Env variables (create .env or export before run)
    • DJANGO_SETTINGS_MODULE=backend.settings
    • SECRET_KEY=<django-secret>
    • GROQ_API_KEY=<your-groq-key>
    • Optional: CHROMADB_PATH=<absolute_path_to_chromadb_data> (default: ./chromadb_data)
  5. Migrate DB
    python manage.py migrate
    
  6. Load permanent knowledge (optional but recommended) Place permanent PDFs in permanent_knowledge/, then:
    python manage.py load_permanent_knowledge --knowledge-dir=permanent_knowledge
    # use --force-reload to rebuild the permanent collection
    
  7. Run backend
    python manage.py runserver
    

Project evidence

Verified from the local repository folder D:\SevaBot-A-RAG-based-nepali-chatbot and its README instructions.

Current status

In development

Project links

Repository

Frontend Setup

  1. cd frontend
    npm install
    
  2. Run dev server (defaults to port 5173)
    npm run dev
    
  3. Frontend expects API at http://localhost:8000/api. Adjust frontend/src/services/api.js if you change the backend host/port.

Using the App

  • Login/Signup from the UI; tokens are handled automatically.
  • Start a chat (sidebar “नयाँ कुराकानी”).
  • Upload PDFs to a chat using the 📎 button; uploads are tied to that conversation only and retrieval stays isolated.
  • Ask questions; answers show source chips (USER for uploaded PDFs, PERM for permanent KB).
  • Edit a user message; the assistant reply refreshes and shows new sources.
  • Delete a conversation; messages clear.
  • Delete an uploaded document from the Documents tab; the backend also drops its Chroma collection.

Data & Files Not in Git

  • chromadb_data/ (vector store) – auto-created at runtime.
  • db.sqlite3 (Django DB) – create locally via migrations.
  • Uploaded PDFs (media/pdfs/) – user data.
  • Permanent PDFs are expected in permanent_knowledge/ locally; not tracked in git.

Maintenance Tips

  • Clear Chroma: stop the server, remove chromadb_data/, rerun loaders.
  • CUDA warnings during load_permanent_knowledge are safe on CPU-only boxes.
  • OCR image-only PDFs: if a file can’t be ingested (zlib/header errors), run OCR (e.g., ocrmypdf input.pdf output.pdf) and reload.

Troubleshooting

  • ModuleNotFoundError: django: activate venv (source venv/bin/activate).
  • Missing GROQ key: set GROQ_API_KEY env var.
  • Sources show “Unknown file”: ensure source_file metadata exists; permanent loader sets it from the PDF filename.

Quick Start (fresh clone)

# backend
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python manage.py migrate
python manage.py load_permanent_knowledge --knowledge-dir=permanent_knowledge  # optional
python manage.py runserver

# frontend (new terminal)
cd frontend
npm install
npm run dev

Visit the frontend (default http://localhost:5173) and start chatting.