A Retrieval-Augmented Generation (RAG) chatbot built with Next.js, Google's Gemini AI, and Qdrant vector database. This application provides intelligent responses about bakery products, services, and information by combining document retrieval with AI-generated responses.
- Real-time Chat Interface: Clean, responsive chat UI built with Next.js and DaisyUI
- RAG Implementation: Uses Gemini embeddings and Qdrant for semantic search
- Smart Context: Retrieves relevant bakery information to provide accurate responses
- Emoji-rich Responses: Friendly AI responses with contextual emojis
- Auto-scrolling Chat: Smooth scrolling to latest messages
- Frontend: Next.js 15.5, React 19, TailwindCSS, DaisyUI
- AI/ML: Google Gemini AI (embeddings and text generation)
- Vector DB: Qdrant Cloud
- Data Processing: LangChain for document processing and RAG
- Language: TypeScript
- Node.js (v18 or higher)
- NPM or Yarn
- Google AI API key
- Qdrant Cloud instance
-
Clone the repository
-
Install dependencies: ```bash npm install ```
-
Create `.env.local` file: ```env GOOGLE_API_KEY=your_google_ai_api_key QDRANT_URL=your_qdrant_cloud_url QDRANT_API_KEY=your_qdrant_api_key ```
- Place your text documents in the `documents` folder
- Run the Python ingestion script: ```python
python ingest.py ```
-
Start the development server: ```bash npm run dev ```
-
Open http://localhost:3000 in your browser
``` src/ ├── app/ │ ├── api/ │ │ └── search/ │ │ └── route.ts # RAG search endpoint │ ├── layout.tsx # App layout with Geist font │ ├── page.tsx # Chat interface │ └── globals.css # Global styles + DaisyUI └── lib/ ├── qdrant.ts # Qdrant client configuration └── check-collection.ts # Collection verification tool ```
Search endpoint that combines RAG with Gemini text generation.
Request: ```json { "query": "What are your opening hours?" } ```
Response: ```json { "response": "🕐 We're open Monday to Friday from 7 AM to 7 PM, and Saturday from 8 AM to 5 PM. We're closed on Sundays! 🎂" } ```
- Collection: `newDocs`
- Vectors: 3072 dimensions (Gemini embeddings)
- Distance: Cosine similarity
- Payload Structure:
{ "text": "Document content", "source": "documents/filename.txt" }
# Development with hot reload
npm run dev
# Build for production
npm run build
# Production server
npm run start
# Lint code
npm run lint- Next.js - React framework
- Gemini AI - AI model for embeddings and text generation
- Qdrant - Vector database
- LangChain - RAG framework
- DaisyUI - UI components
- TailwindCSS - Styling
This project is licensed under the MIT License.