π§ RAG-Based AI Assistant β Module 1 Project (AAIDC)
Overview
This project implements a Retrieval-Augmented Generation (RAG) based AI Assistant using LangChain, vector databases, and large language models.
The goal is to build a system that can load documents, embed them, store them in a vector store, and retrieve relevant information to answer user queries.
Objectives
Understand and implement RAG architecture
Use text chunking and embeddings
Store and retrieve data using ChromaDB
Build a simple AI assistant capable of contextual answers
Demonstrate a working end-to-end RAG pipeline
ποΈ System Architecture
User Query β Embedding β Vector DB (Search) β Relevant Documents
β LLM Prompt + Retrieved Context β Final Answer
Key components:
LangChain for chaining LLM + retrieval
Sentence Transformers for embeddings
ChromaDB for vector storage
Python for application workflow
.env file for secure API key management
π Project Structure
βββ data/
β βββ sample_docs/
βββ src/
β βββ vectordb.py
β βββ rag_assistant.py
β βββ app.py
β βββ utils.py
βββ .env.example
βββ requirements.txt
βββ README.md
Setup Instructions
1οΈβ£ Clone the Repository
git clone
cd rag-ai-assistant
2οΈβ£ Create Virtual Environment
python -m venv venv
venv\Scripts\activate
3οΈβ£ Install Dependencies
pip install -r requirements.txt
4οΈβ£ Configure Environment Variables
Create .env file based on .env.example:
OPENAI_API_KEY=your_key_here
GOOGLE_API_KEY=your_key_here
GROQ_API_KEY=your_key_here
π Loading and Embedding Documents
Example code snippet:
def load_documents():
folder = "./data"
documents = []
for filename in os.listdir(folder):
if filename.endswith(".txt"):
with open(os.path.join(folder, filename), "r", encoding="utf-8") as f:
documents.append(f.read())
return documents
Retrieval and Generation
results = assistant.query("What is this document talking about?")
print("Answer:", results)
The assistant searches the vector DB for relevant chunks and generates contextual answers.
π Key Features
Automatic document embedding
Chunking + metadata tracking
Vector similarity search
Multi-provider LLM support (OpenAI / Google / Groq)
Clean modular architecture
π Results
The system successfully retrieves relevant context and generates improved responses compared to a non-RAG chatbot.
Examples:
User: βExplain Section 2 of the document.β
Assistant: (Responds with retrieved context + LLM output)
π Security Practices
.env is kept out of GitHub (included in .gitignore)
.env.example is provided for safe reproducibility
No API keys are exposed in the repository
π Conclusion
This project demonstrates a fully functional RAG pipeline as required for AAIDC Module 1. It integrates modern LLM workflows with vector search to produce contextual, relevant answers.