A complete full-stack Retrieval-Augmented Generation (RAG) system with modern web interface and intelligent backend, delivering specialized AI assistance across multiple domains.
Modern, responsive chat interface with real-time messaging and typing indicators
- 🎯 Business Impact: Intelligent knowledge assistant across 5 critical domains (Agriculture, Education, Environment, Finance, Healthcare)
- ⚡ Performance: Sub-second response times with real-time performance tracking
- 💰 Cost Management: Smart credit-based usage control preventing API abuse
- 🔒 Production-Ready: Secure API key management, CORS support, and scalable serverless architecture
- 🤖 Multi-Domain AI Assistant: 5 specialized categories with domain-specific knowledge bases
- 💬 Advanced Chat Interface: Real-time chat with typing indicators and message history
- 🔐 User Authentication: Supabase integration with credit-based usage system
- 🎨 Modern UI/UX: Built with Next.js 15, React 19, and Tailwind CSS
- 📱 Responsive Design: Works seamlessly across desktop and mobile devices
- Query Embedding → Cohere's
embed-english-v3.0converts queries to 1024-dim vectors - Semantic Search → Pinecone retrieves top-3 relevant documents with domain filtering
- Context Augmentation → Retrieved documents provide contextual knowledge
- Response Generation → Google Gemini 1.5 Flash generates human-like responses
- Metadata Enrichment → Returns sources, confidence scores, and performance metrics
- Next.js 15 - React framework with App Router and dynamic routing
- React 19 - Latest React with enhanced performance
- Tailwind CSS - Utility-first CSS framework with dark/light theme support
- Supabase - User authentication and management
- LocalStorage - Message history persistence
- FastAPI - High-performance async web framework
- Python - Latest Python with enhanced performance
- Pydantic - Data validation and serialization
- Google Gemini 1.5 Flash - Large Language Model for response generation
- Cohere v3.0 - State-of-the-art text embeddings
- Custom System Instructions - Optimized prompts for consistent output
- Pinecone - Serverless vector database (AWS us-east-1)
- Redis - Managed Redis for credit tracking
- JSON Data Sources - Curated domain-specific knowledge bases
- Supabase Database - User data and chat history storage
| Domain | Use Cases | Sample Query |
|---|---|---|
| 🌾 Agriculture | Farming practices, crop management, agricultural policies | "What are the best drought-resistant crops for Indian farmers?" |
| 🎓 Education | Educational policies, curriculum, learning resources | "What are the key features of India's National Education Policy 2020?" |
| 🌍 Environment | Climate policies, renewable energy, sustainability | "What are India's commitments under COP26?" |
| 💼 Finance | Economic policies, financial regulations, market insights | "What are the latest RBI monetary policy changes?" |
| 🏥 Healthcare | Health policies, medical guidelines, public health | "What are India's vaccination strategies for rural areas?" |
- Node.js 18+ and npm/yarn
- Python 3.12+
- API Keys: Google Gemini, Cohere, Pinecone, Upstash Redis
- Supabase project for authentication
# Clone the repository
git clone <repository-url>
cd Rag_ChatBot_Backend
# Install dependencies
pip install -r requirements.txt
# Set environment variables
cp .env.example .env
# Add your API keys to .env
# Run the backend
uvicorn main:app --reload# Navigate to frontend directory
cd rag-frontend
# Install dependencies
npm install
# Set environment variables
cp .env.local.example .env.local
# Add your Supabase keys
# Run the development server
npm run devBackend (.env)
GEMINI_API_KEY=your_gemini_api_key
COHERE_API_KEY=your_cohere_api_key
PINECONE_API_KEY=your_pinecone_api_key
REDIS_URL=your_upstash_redis_url
REDIS_TOKEN=your_upstash_redis_tokenFrontend (.env.local)
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
NEXT_PUBLIC_BACKEND_URL=http://localhost:8000ChatBot/
├── Rag_ChatBot_Backend/ # Backend API
│ ├── main.py # FastAPI application entry point
│ ├── requirements.txt # Python dependencies
│ ├── config/
│ ├── embeddings/
│ ├── llms/
│ ├── response/
│ └── sample_data/
└── rag-frontend/ # Next.js Frontend
├── src/
│ ├── app/ # Next.js App Router
│ │ ├── layout.js # Root layout
│ │ ├── page.js # Home page
│ │ └── chat/ # Chat routes
│ ├── components/ # Reusable components
│ ├── context/ # React context providers
│ ├── lib/
│ └── utils/
└── public/ # Static assets
Ready to discuss how this RAG system can solve your business challenges?
- 📧 Email: himadrikaran516@gmail.com | karanhimadri1234@gmail.com
- 💼 LinkedIn: linkedin.com/in/himadrikaran
- 🐱 GitHub: github.com/karanhimadri
Built with ❤️ for intelligent information retrieval and enhanced user experiences. A complete full-stack solution combining cutting-edge AI with modern web technologies.


