Ask questions about any PDF using a local RAG pipeline. Upload a document, get instant answers grounded in the text — no hallucinations, no guessing.
PDF → text extraction → chunking (500 chars, 100 overlap)
→ sentence-transformers embeddings (all-MiniLM-L6-v2)
→ FAISS index (cosine similarity)
Question → embed → top-4 chunk retrieval
→ LLaMA 3.3 70B (Groq) answers using only retrieved context
- Parse —
pdfplumberextracts raw text from any PDF - Chunk — text split into 500-char overlapping chunks
- Embed —
sentence-transformersconverts each chunk to a 384-dim vector - Index —
FAISSstores vectors for fast cosine similarity search - Retrieve — at query time, top-4 most relevant chunks are fetched
- Generate —
LLaMA 3.3 70Bvia Groq answers using only those chunks
1. Get a free Groq API key
Sign up at console.groq.com — free tier is generous.
2. Clone and install
git clone https://github.com/sa1701/rag-pdf-chat
cd rag-pdf-chat
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt3. Set your API key
cp .env.example .env
# Edit .env and add your GROQ_API_KEY4. Run
streamlit run app.py| Component | Library |
|---|---|
| UI | Streamlit |
| PDF parsing | pdfplumber |
| Embeddings | sentence-transformers (all-MiniLM-L6-v2) |
| Vector store | FAISS (CPU) |
| LLM | LLaMA 3.3 70B via Groq API |
| Orchestration | LangChain |
- Push to GitHub
- Go to share.streamlit.io
- Connect repo, set
app.pyas entrypoint - Add
GROQ_API_KEYin Secrets settings