A clean, beginner-friendly implementation of a Retrieval-Augmented Generation (RAG) system for document-based question answering.
This project demonstrates how modern AI systems retrieve relevant information from documents and use a Large Language Model (LLM) to generate accurate, grounded answers instead of guessing. It is designed for learning, experimentation, and portfolio use.
This project is officially published on Ready Tensor:
This project helps you understand how RAG works in practice. It is useful if you want to:
- Learn Retrieval-Augmented Generation (RAG)
- Understand document-based question answering
- Build a portfolio project for jobs or internships
- Experiment with LLMs safely
- Create a Google Colab or Kaggle demo
The assistant answers questions only from uploaded documents, reducing hallucinations and improving reliability.
- Load documents in common formats:
.txt.pdf.docx
- Split documents into meaningful chunks
- Convert text into vector embeddings
- Store embeddings in a vector database
- Retrieve the most relevant content for a query
- Generate answers grounded in retrieved context
- Switch between LLM providers without changing core logic
- 📄 Document ingestion
- 🔍 Semantic search using embeddings
- 🤖 Retrieval-Augmented Generation
- 🌍 Multiple LLM providers
- 🔒 Secure by design (no hardcoded API keys)
- 🧪 Ideal for experimentation and learning
- 📦 Works smoothly in Google Colab and Kaggle
The system supports multiple LLM APIs:
- OpenAI
- Groq
- Google Gemini
The provider can be selected at runtime without modifying the RAG pipeline.
- Documents are loaded from a
data/folder - Text is split into overlapping chunks
- Embeddings are created for each chunk
- Embeddings are stored in a vector database (ChromaDB)
- A user question retrieves the most relevant chunks
- The LLM generates an answer only from retrieved content
This ensures:
- Reduced hallucinations
- Transparent reasoning
- Document-grounded answers
Visit https://colab.research.google.com
Open the provided notebook or upload RAG_Implementation_v2.ipynb.
All required dependencies are listed in requirements.txt.
Run once:
!pip install -q -r requirements.txt- Create a folder named
data/ - Upload your
.txt,.pdf, or.docxfiles using the file panel
Supported providers:
- OpenAI
- Groq
- Google Gemini
Provide API keys securely using environment variables (never hardcode keys).
After documents are indexed, ask questions like:
- “What is NLP?”
- “Explain embeddings from the documents”
- “Summarize the uploaded files”
The assistant responds only using your documents.
- Not optimized for large-scale production
- Requires valid API keys
- Model availability may change
- Designed mainly for educational and portfolio use
This project is shared for educational and personal use.
This project uses open-source tools such as LangChain, ChromaDB, and sentence-transformers to demonstrate Retrieval-Augmented Generation in a simple and understandable way.
