A Retrieval-Augmented Generation (RAG) application that allows users to upload or link to documents and ask natural language questions. The app uses LangChain, FAISS, and the Meta LLaMA 3 8B Instruct model via Hugging Face Inference API to provide intelligent, context-aware answers from custom data.
- π Accepts input from:
- Web URLs
- Plain Text
- PDF Files
- DOCX Files
- TXT Files
- π§© Text is split and embedded using
HuggingFace BGE Embeddings - β‘ Indexed via
FAISSfor fast semantic retrieval - π§ Context-relevant responses generated using
Meta-LLaMA-3-8B-Instruct - π Improved document query accuracy by 40% and reduced lookup time by 50%
- LangChain β Framework for building LLM applications
- FAISS β Facebook AI Similarity Search for vector indexing
- Hugging Face β Hosting LLaMA 3 and BGE models
- Streamlit β UI framework for interactive apps
- PyPDF2 β Parsing PDF content
- python-docx β Reading DOCX files
- NumPy β Vector operations
-
Clone the repository
git clone [https://github.com/yourusername/rag-qa-app.git](https://github.com/Srinikhil/RAG-QnA-App.git) cd rag-qa-app -
Create a virtual environment and install dependencies
pip install -r requirements.txt
-
Set up your Hugging Face API token
Create a file called
secret_api_key.pyin the root directory and add your token:huggingface_access_token = "your_huggingface_token_here"
-
Run the application
streamlit run app.py
- Choose an input type from the dropdown (Text, Link, PDF, DOCX, TXT File)
- Upload or enter the required input
- Click on
Proceedto process documents - Ask your question in the input box
- Click
Submitto get an answer
- The app currently runs on CPU (change
device: 'cpu'to'cuda'if GPU is available) - Suitable for academic, business, and research-based document querying
- Embeddings model:
sentence-transformers/all-mpnet-base-v2 - LLM:
meta-llama/Meta-Llama-3-8B-Instructvia Hugging Face Inference Endpoint
This project is licensed under the MIT License. See the LICENSE file for details.