বই বন্ধু - Bengali Textbook RAG Assistant
An end-to-end retrieval-augmented study companion over the NCTB national curriculum: students pick a chapter, ask questions in English or Bangla, take auto-generated quizzes and track their progress — every answer grounded in that chapter's own textbook pages.
- LangChain / LangChain-Core / LangChain-Community / LangChain-Classic, BM25Retriever
+ FAISS dense vectors combined through EnsembleRetriever (hybrid weights 0.4/0.6,
k=5), with an md5-hashed per-chapter index layout under
embedding_cache/— retrieval loads pre-builtindex.faiss+index.pklinstead of re-embedding anything at query time. - Offline data pipeline with EasyOCR (Bangla + English, GPU-accelerated via
PyTorch/torchvision), pdf2image + Poppler and
RecursiveCharacterTextSplitter(chunk 1500 / overlap 350) producing 385 searchable chapters across 27 NCTB books; JSON-based caching with resumable partial runs. - Dense retrieval uses
intfloat/multilingual-e5-base(768-d) with thequery:/passage:prefixes, so the stored chunk text stays clean; the model directory is flattened and baked into the container image (cache trimmed 10.1 GB → 1.1 GB by dropping duplicate weight formats). - Grounded generation with Groq (
openai/gpt-oss-120b) as primary and DeepSeek (deepseek-chat) as automatic fallback, streamed to the browser as NDJSON token events with page-level citations and follow-up-question detection. - Quiz + progress layer: FastAPI generates 5 chapter-grounded MCQs per request with the answer key kept server-side, grades them with explanations, and stores one SQLite (WAL) row per answered question — powering per-chapter accuracy, weak-topic detection, a subject filter, resettable history and an LLM-written parent summary with a deterministic fallback.
- Bilingual by design (English default, one toggle to বাংলা) across UI labels, subject
names, machine-translated chapter titles and the AI's answer language; deployed as a
Docker image on AWS EC2 with a Next.js 16 frontend on Vercel that proxies
/api/*server-side, so the HTTPS site never hits the plain-HTTP backend (no CORS, no mixed content). - Next.js 16 (App Router, Turbopack) + React 19 + TypeScript, Tailwind CSS v4, react-markdown + remark-gfm for answer rendering, lucide-react icons, and Hind Siliguri (Bengali webfont) via next/font; catalog served with ETag, gzip and a localStorage cache for instant repeat loads.

