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.


