Skip to content

πŸ“„ Chat with your PDFs using AI! πŸ€– Extracts content, finds answers with FAISS, and replies smartly using LLaMA 3 on GROQ πŸš€

Notifications You must be signed in to change notification settings

ZeeBee287/PDF-based-RAG-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“„ PDF RAG Q&A App – Streamlit + FAISS + GROQ

PDF RAG Q&A App is an AI-powered web app that:

  • πŸ“€ Accepts any PDF document,
  • πŸ” Splits and embeds the content using sentence-transformers + FAISS,
  • πŸ€– Answers natural language questions using Groq-hosted LLaMA 3,
  • πŸ’¬ Maintains a Q&A history β€” all in an interactive Streamlit interface.

πŸš€ Features

  • πŸ“– PDF Text Extraction using PyPDF2
  • βœ‚οΈ Automatic Chunking for long documents
  • 🧠 Embedding with MiniLM (Hugging Face)
  • πŸ”Ž Fast Semantic Search via FAISS
  • πŸ€– Answer Generation using LLaMA 3 on Groq
  • πŸ’¬ Chat History tracked during session
  • 🌐 Colab-Compatible UI with LocalTunnel link

πŸ“ Project Structure

pdf-rag-streamlit-groq/
β”‚
β”œβ”€β”€ app.py               # Streamlit UI
β”œβ”€β”€ rag_module.py        # RAG logic: extraction, embeddings, query
β”œβ”€β”€ requirements.txt     # All Python dependencies
└── README.md            # You're here!

πŸ”§ Requirements

Install all dependencies using:

pip install -r requirements.txt

πŸ”‘ API Keys Required

Get GROQ API Key:

  1. Visit https://console.groq.com/keys
  2. Create a free account
  3. Click Create API Key β†’ Give it a name β†’ Submit
  4. Copy your key

Set your key as an environment variable (e.g. in Colab or .env):

GROQ_API_KEY_1=your_groq_api_key_here

πŸ’» How to Run in Google Colab

  1. Upload app.py, rag_module.py, and requirements.txt to a Colab notebook.
  2. Install dependencies:
!pip install -r requirements.txt
  1. Set your API key in another cell:
import os
os.environ['GROQ_API_KEY_1'] = "your_groq_api_key"
  1. Add the code for rag_module.py and app.py using %%writefile, then launch the app:
!wget -q -O - ipv4.icanhazip.com  # Optional: View public IP
!streamlit run app.py & npx localtunnel --port 8501
  1. Open the generated .loca.lt link to start chatting with your PDF! πŸŽ‰

πŸ€– Models Used

Purpose Model / Tool
Embedding Text sentence-transformers/all-MiniLM-L6-v2
Vector Search FAISS (Flat L2 index)
Answer Generation LLaMA3-8B-8192 hosted on Groq

✨ Future Ideas

  • πŸ“‘ Support multiple PDFs in a single session
  • 🧾 Show which chunk or page the answer came from
  • πŸ“₯ Export full Q&A history
  • πŸŽ™οΈ Add voice input / narration

πŸ§‘β€πŸ’» Author

Zahra Batool :D

About

πŸ“„ Chat with your PDFs using AI! πŸ€– Extracts content, finds answers with FAISS, and replies smartly using LLaMA 3 on GROQ πŸš€

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages