A Retrieval-Augmented Generation (RAG) based AI chatbot built using Django, Pinecone, HuggingFace Embeddings, and Groq LLM.
This system allows users to query a technical PDF document (A320 Aircraft Characteristics – Airport & Maintenance Planning) and receive context-grounded answers.
- 📄 PDF-based knowledge system
- 🔍 Semantic search using vector embeddings
- 🧠 Context-aware AI responses (RAG architecture)
- ⚡ Fast LLM inference using Groq (Llama 3.1)
- 🎨 Modern animated UI (Glassmorphism design)
- 🔐 Secure API key management via
.env
Frontend (HTML/JS) User Question
↓ ↓
Django API (/ask) Django Backend
↓ ↓
Embed Query (BGE) SentenceTransformer Embedding
↓ ↓
Pinecone (Top-k chunks) Pinecone Vector Search
↓ ↓
Construct Prompt Retrieve Top Chunk
↓ ↓
Gemini API Groq LLM (Llama 3.1)
↓ ↓
Return Answer Context-Grounded Answer
- PDF is parsed and chunked (in Google Colab).
- Each chunk is converted into embeddings.
- Embeddings are stored in Pinecone.
- When user asks a question:
- Question is embedded.
- Most relevant chunk is retrieved.
- Retrieved context is sent to Groq LLM.
- LLM generates answer strictly from context.
| Layer | Technology Used |
|---|---|
| Backend | Django |
| Embeddings | BAAI/bge-small-en-v1.5 |
| Vector DB | Pinecone (Free Tier) |
| LLM | Groq (Llama 3.1-8b-instant) |
| Frontend | HTML + CSS + JS |
| Deployment | Render (Planned) |
git clone https://github.com/Yash-Lade/RAG_chatbot
cd rag_backendpython -m venv venv
source venv/bin/activate # Mac/Linux
venv\Scripts\activate # Windows
pip install -r requirements.txt
If requirements.txt not created, install manually:
pip install django
pip install sentence-transformers
pip install pinecone-client
pip install groq
pip install python-dotenv
Create a .env file in project root:
PINECONE_API_KEY=your_pinecone_key
GROQ_API_KEY=your_groq_key
Add .env to .gitignore:
.env
venv/
__pycache__/
python manage.py migrate
python manage.py runserver
Open browser:
http://127.0.0.1:8000/
📂 Project Structure
rag_backend/
│
├── manage.py
├── .env
│
├── rag_backend/
│ ├── settings.py
│ ├── urls.py
│
└── chatbot/
├── views.py
├── rag_utils.py
├── urls.py
├── templates/
│ └── index.html
└── static/
└── style.css
- What is the maximum ramp weight of the A320-200?
- Describe the jacking procedure for maintenance.
- What wind limits apply during aircraft jacking?
- What protections are provided by the engine nacelle?
"Not available in document."
Embedding Model
BAAI/bge-small-en-v1.5
Dimension: 384
Similarity: Cosine
LLM Model
llama-3.1-8b-instant
Retrieval Strategy Top K = 1
Context limited to 1200 characters
Max output tokens = 300