How syedraihanm/rag-pdf-chatbot works
This repository is a PDF-focused RAG chatbot with a Streamlit interface and a FastAPI backend. The main workflow uploads a PDF, parses and chunks it, creates a local FAISS index, then rewrites conversational questions, retrieves relevant chunks, and streams a Groq-generated answer with page citations. A separate evaluation script retrieves context and uses Groq as an LLM judge. The graph reflects the shown calls and documented capabilities; unsampled implementation details are not expanded.
Main entry points: vector_store.py Embedding and indexing · evaluate.py LLM-judge evaluation · retrieval.py Chunk retrieval · main.py FastAPI endpoints
Components 15
User interface
- Streamlit dashboard
app.py
Chat service
- FastAPI endpoints
api/main.py - Chat orchestration
src/chat.py - Query rewriting
src/chat.py - Chunk retrieval
src/retrieval.py
Document indexing
- PDF parsing and splitting
src/ingest.py - Embedding and indexing
src/vector_store.py - FAISS index
src/vector_store.py - Stored chunks
src/vector_store.py - Storage configuration
src/config.py
Evaluation
- LLM-judge evaluation
evaluate.py - Evaluation questions
data_structures_rag_evaluation.csv - Evaluation results
ragas_results.csv
Other components
- Document user
- Groq LLM
Connections 21
- Document user → Streamlit dashboard: asks and uploads
README.md - Streamlit dashboard → FastAPI endpoints: calls endpoints
app.py - FastAPI endpoints → Embedding and indexing: indexes upload
api/main.py - Embedding and indexing → PDF parsing and splitting: loads and splits
src/vector_store.py - PDF parsing and splitting → Storage configuration: gets PDF path
src/ingest.py - Embedding and indexing → Storage configuration: gets store paths
src/vector_store.py - Embedding and indexing → FAISS index: writes index
src/vector_store.py - Embedding and indexing → Stored chunks: saves chunks
src/vector_store.py - FastAPI endpoints → Chat orchestration: requests stream
api/main.py - Chat orchestration → Query rewriting: rewrites follow-up
src/chat.py - Chat orchestration → Chunk retrieval: retrieves context
src/chat.py - Chunk retrieval → FAISS index: searches vectors
src/retrieval.py - Chunk retrieval → Stored chunks: loads chunk data
src/retrieval.py - Chunk retrieval → Storage configuration: gets store paths
src/retrieval.py - Chat orchestration → Groq LLM: rewrites and generates
src/chat.py - FastAPI endpoints → Streamlit dashboard: streams tokens and citations
app.py - Document user → LLM-judge evaluation: benchmarks answers
README.md - LLM-judge evaluation → Evaluation questions: reads questions
evaluate.py - LLM-judge evaluation → Chunk retrieval: retrieves context
evaluate.py - LLM-judge evaluation → Groq LLM: scores responses
evaluate.py - LLM-judge evaluation → Evaluation results: writes scores
evaluate.py