How tanuj26rajput/rag-project works
This is a single-file Streamlit app for PDF question answering. The user uploads a PDF, the app extracts and indexes its text, then uses retrieval-augmented generation to answer questions and display chat history. The README also documents embeddings, FAISS retrieval, PDF parsing, and multi-turn chat; these are reflected alongside the sampled implementation. All source relationships shown are visible in model.py; the hosted Hugging Face model is an external dependency.
Main entry points: model.py RAG chain
Components 12
Chat interface
- Streamlit UI
model.py - Chat history
model.py
Document processing
- PDF extraction
model.py - Text chunking
model.py - Embeddings
model.py - FAISS index
model.py - Similarity retriever
model.py
Answer generation
- RAG chain
model.py - Context prompt
model.py - Hugging Face LLM
- Answer parser
model.py
Other components
- User
Connections 12
- User → Streamlit UI: uploads and asks
model.py - Streamlit UI → PDF extraction: calls load_docs
model.py - Streamlit UI → RAG chain: builds and invokes
model.py - Streamlit UI → Chat history: stores and displays
model.py - RAG chain → Text chunking: splits documents
model.py - RAG chain → Embeddings: creates embeddings
model.py - RAG chain → FAISS index: indexes chunks
model.py - FAISS index → Similarity retriever: creates retriever
model.py - RAG chain → Similarity retriever: retrieves context
model.py - RAG chain → Context prompt: formats context and question
model.py - RAG chain → Hugging Face LLM: generates answer
model.py - RAG chain → Answer parser: parses output
model.py