How ashutosh-6398/pdf-rag-chatbot works
PDF RAG Chatbot supports PDF ingestion, persistent semantic indexing, and context-grounded question answering through both a browser/API workflow and the documented command-line workflow. Uploads and the CLI indexer share extraction, chunking, and embedding utilities; API and CLI question paths retrieve from ChromaDB before generating an answer with Hugging Face inference. The sampled sources support these calls; README capabilities also describe the indexing and retrieval stages.
Main entry points: upload.py PDF upload processing · rag.py API question retrieval · index.py CLI indexer · utils.py Embedding utilities
Components 16
Web interface
- Chat UI
frontend/script.js
API workflows
- FastAPI routes
backend/main.py - PDF upload processing
backend/upload.py - API question retrieval
backend/rag.py - CLI indexer
index.py - CLI chat
chat.py
RAG processing
- PDF text extraction
utils.py - Text chunking
utils.py - Embedding utilities
utils.py - Similarity retrieval
backend/rag.py - Context prompt
backend/rag.py - Answer generation
utils.py
Vector storage
- Persistent vector store
backend/rag.py
Other components
- User
- SentenceTransformer
- Hugging Face inference
Connections 25
- User → Chat UI: asks or uploads
- Chat UI → FastAPI routes: sends requests
- FastAPI routes → PDF upload processing: processes PDF
- PDF upload processing → PDF text extraction: extracts text
- PDF upload processing → Text chunking: splits text
- PDF upload processing → Embedding utilities: embeds chunks
- Embedding utilities → SentenceTransformer: encodes text
- PDF upload processing → Persistent vector store: stores chunks
- FastAPI routes → API question retrieval: asks question
- API question retrieval → Embedding utilities: embeds query
- API question retrieval → Similarity retrieval: queries store
- Similarity retrieval → Persistent vector store: searches vectors
- API question retrieval → Context prompt: builds context
- API question retrieval → Answer generation: generates answer
- Answer generation → Hugging Face inference: requests completion
- FastAPI routes → Chat UI: returns answer
- User → CLI indexer: runs indexing
- CLI indexer → PDF text extraction: extracts text
- CLI indexer → Text chunking: splits text
- CLI indexer → Embedding utilities: embeds chunks
- CLI indexer → Persistent vector store: stores vectors
- User → CLI chat: asks question
- CLI chat → Embedding utilities: embeds query
- CLI chat → Persistent vector store: searches vectors
- CLI chat → Answer generation: generates answer