A Retrieval-Augmented Generation (RAG) system that allows you to ask questions about your PDF documents using AI.
- 📄 PDF Document Processing: Load and process PDF documents from a directory
- 🤖 AI-Powered Q&A: Ask questions and get intelligent answers based on your documents
- 🔍 Document Similarity Search: See which parts of documents were used to answer questions
- 💰 Cost-Effective: Uses free HuggingFace embeddings and Groq LLM
- 🌐 Web Interface: Beautiful Streamlit web interface
- Python 3.8+
- Groq API key
- HuggingFace token (optional, for better performance)
-
Clone the repository:
git clone <your-repo-url> cd RAG_QnA
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables: Create a
.envfile in the project root with:GROQ_API_KEY=your_groq_api_key_here OPENAI_API_KEY=your_openai_api_key_here HF_TOKEN=your_huggingface_token_here
streamlit run app_huggingfaceembedding.pystreamlit run main.py- Add PDF documents to the
research_papers/folder - Start the application using one of the commands above
- Click "Document Embedding" to process your documents
- Ask questions in the text input field
- View answers and explore document sources
RAG_QnA/
├── app_huggingfaceembedding.py # Main app with HuggingFace embeddings
├── main.py # Main app with OpenAI embeddings
├── requirements.txt # Python dependencies
├── .env # Environment variables (not in git)
├── .gitignore # Git ignore rules
├── README.md # This file
└── research_papers/ # PDF documents folder
├── Attention.pdf
└── LLM.pdf
- Sign up at HuggingFace.co
- Go to Settings > Access Tokens
- Create a new token with "Read" permissions
- Add to
.envfile
- Sign up at OpenAI.com
- Go to API Keys
- Create a new API key
- Add to
.envfile
- Streamlit: Web interface
- LangChain: RAG framework
- HuggingFace: Free embeddings
- Groq: Fast LLM responses
- FAISS: Vector database
- PyPDF: PDF processing
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This project is open source and available under the MIT License.
If you encounter any issues, please:
- Check the Issues page
- Create a new issue with detailed information
- Include error messages and steps to reproduce