An AI-powered Retrieval-Augmented Generation (RAG) application that answers questions using your own documents instead of relying only on the language model's knowledge. The system processes PDF, TXT, and Markdown files, retrieves the most relevant document sections using semantic search, and generates accurate responses with Qwen2.5.
- 📄 Supports PDF, TXT, and Markdown documents
- 🔍 Semantic document retrieval using FAISS
- 🧠 Sentence Transformer embeddings
- 🤖 Open-source Qwen2.5 language model
- 💬 Interactive command-line chat mode
- ⚡ Fast local vector database
- 📊 Retrieval evaluation support
- 🔄 Easily replaceable embedding and LLM models
Documents (PDF / TXT / MD)
│
▼
Document Chunking
│
▼
Sentence Transformer Embeddings
│
▼
FAISS Vector Database
│
▼
User Question
│
▼
Semantic Similarity Search
│
▼
Top Relevant Document Chunks
│
▼
Qwen2.5 Instruction Model
│
▼
Context-Aware AI Response
rag-document-qa
│
├── src
│ ├── ingest.py
│ ├── rag_pipeline.py
│ └── evaluate.py
│
├── requirements.txt
├── README.md
└── documents/
- Python
- LangChain
- Hugging Face Transformers
- Sentence Transformers
- FAISS
- Qwen2.5
- PyTorch
Clone the repository
git clone https://github.com/yourusername/rag-document-qa.gitMove to the project folder
cd rag-document-qaCreate a virtual environment
python -m venv venvActivate it
venv\Scripts\activatesource venv/bin/activateInstall dependencies
pip install -r requirements.txtpython src/ingest.pypython src/rag_pipeline.pypython src/evaluate.py- Load documents.
- Split documents into chunks.
- Generate embeddings using Sentence Transformers.
- Store embeddings in a FAISS vector database.
- Accept user queries.
- Retrieve the most relevant document chunks.
- Provide retrieved context to the Qwen2.5 model.
- Generate an accurate, grounded response.
- Python 3.10+
- langchain
- faiss-cpu
- sentence-transformers
- transformers
- torch
- accelerate
- pypdf
Install all dependencies:
pip install -r requirements.txt- No paid APIs required
- Local document search
- Fast semantic retrieval
- Accurate context-based responses
- Easy to customize
- Supports multiple document formats
- Streamlit web interface
- FastAPI REST API
- OCR support for scanned PDFs
- Hybrid search (BM25 + Dense Retrieval)
- Conversation memory
- Docker deployment
- Multi-document collections
Contributions are welcome.
- Fork the repository.
- Create a feature branch.
- Commit your changes.
- Push your branch.
- Open a Pull Request.
This project is licensed under the MIT License.
Giri Venkateswara Rao
AI & Full Stack Developer
⭐ If you found this project helpful, please give it a Star!