Skip to content

feat: add RAG chatbot to portfolio #1

Description

@samridhsri

Overview

Add an AI-powered chatbot to the portfolio site that answers questions about
my career, projects, and skills using RAG (Retrieval-Augmented Generation).

Stack: FastAPI · ChromaDB · sentence-transformers · Groq API (llama-3.1-8b-instant) · React


Phase 1 — Knowledge base ~1-2 hrs

  • Create knowledge/ directory with 6 markdown files:
    about.md, experience.md, education.md, projects.md, skills.md, faqs.md
  • Populate faqs.md with 10–15 recruiter-facing Q&As
  • Keep each file under ~800 words for clean chunking

Deliverable: knowledge/ directory ready to ingest


Phase 2 — Ingest pipeline ~2-3 hrs

  • Set up Python venv + requirements.txt
    (langchain, sentence-transformers, chromadb, python-dotenv)
  • Write ingest.py: load markdowns → chunk (400 tok, 50 overlap) → embed → upsert ChromaDB
  • Verify retrieval quality with manual similarity queries

Deliverable: chroma_db/ persisted locally, retrieval verified


Phase 3 — FastAPI backend ~3-4 hrs

  • Scaffold main.py with POST /chat endpoint (accepts {message, history[]}, returns SSE)
  • Build RAG chain: embed query → Chroma top-3 → build system prompt → stream via Groq
  • Add CORS guard (portfolio domain only) + rate limiting (slowapi, 10 req/min per IP)
  • Test locally with curl / Postman — verify streaming and context injection

Deliverable: backend running on localhost:8000, streaming verified


Phase 4 — React chat widget ~3-4 hrs

  • Build ChatWidget.jsx: floating button → panel toggle, message list, input box
  • Wire SSE streaming via fetch + ReadableStream (token-by-token append)
  • Add 3 starter prompt chips ("What projects have you built?", etc.)
  • Style to match existing portfolio theme (inherit CSS variables / Tailwind tokens)

Deliverable: widget live on local dev, end-to-end chat working


Phase 5 — Deploy ~1-2 hrs

  • Add Dockerfile to backend repo (Railway auto-deploys from GitHub)
  • Set GROQ_API_KEY and ALLOWED_ORIGIN env vars on Railway
  • Update VITE_API_URL in frontend to Railway URL, redeploy portfolio
  • Smoke test on production — streaming latency, CORS, 3–5 message flow

Deliverable: chatbot live on portfolio domain


Notes

  • Commit chroma_db/ to repo (re-run ingest as Dockerfile startup step if it grows)
  • Pass last 3 message pairs per request for session memory — no DB needed
  • Re-run ingest.py whenever knowledge base files are updated

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions