An open API service indexing awesome lists of open source software.

https://github.com/dan10ish/cogni-cart

Lightning-fast multi-agent shopping assistant with real Indian product data and instant search results!
https://github.com/dan10ish/cogni-cart

fastapi gemini-api google-adk nextjs python

Last synced: 4 months ago
JSON representation

Lightning-fast multi-agent shopping assistant with real Indian product data and instant search results!

Awesome Lists containing this project

README

          

# 🛒 CogniCart - AI-Powered E-commerce Assistant

**Lightning-fast multi-agent shopping assistant with real Indian product data and instant search results!**

## 🚀 Features

### ⚡ **Lightning-Fast Search**
- **Sub-second response times** with our optimized product database
- **Real Indian products** with authentic pricing in INR
- **20+ authentic products** from popular brands like Samsung, Apple, Sony, boAt, Xiaomi, HP, Dell, and more

### 🤖 **Multi-Agent AI Architecture**
- **Query Understanding Agent**: Parses natural language into structured search criteria
- **Product Search Agent**: Fast database lookup with intelligent ranking and filtering
- **Review Analyzer Agent**: Analyzes customer reviews for sentiment and insights
- **Deal Finder Agent**: Identifies deals, discounts, and value assessments
- **Coordinator Agent**: Orchestrates all agents for comprehensive responses

### 💰 **Real Indian E-commerce Data**
- **Authentic pricing** from Amazon.in and Flipkart
- **Popular products** across categories:
- 📱 **Smartphones**: Samsung Galaxy M34 (₹17,999), iPhone 13 (₹54,900), OnePlus 11R (₹39,999)
- 💻 **Laptops**: HP Pavilion i5 (₹54,990), Dell Inspiron (₹47,990), Lenovo IdeaPad (₹41,990)
- 🎧 **Audio**: boAt Airdopes 141 (₹1,299), Sony WH-CH720N (₹8,990), JBL Tune 770NC (₹7,999)
- 🏠 **Home**: Vacuum cleaners from Eureka Forbes, AGARO, Black+Decker
- ⌚ **Smartwatches**: Fire-Boltt Phoenix Pro (₹2,799), Samsung Galaxy Watch4 (₹16,999)

### 🎯 **Smart Features**
- **Budget-aware search**: "wireless earbuds under 3000 rupees"
- **Feature matching**: Finds products with specific features you need
- **Brand preferences**: Supports preferred brand filtering
- **Real customer reviews**: Authentic review analysis and sentiment scoring
- **Product comparison**: Side-by-side comparison of up to 3 products
- **Deal detection**: Identifies value-for-money products and deals

## 🏗️ Architecture

```
Frontend (Next.js + TypeScript + Shadcn UI)
↓ HTTP API calls
Backend (FastAPI + Python)
↓ Multi-Agent Processing
┌─────────────────────────────────────────┐
│ Coordinator Agent │
├─────────────────────────────────────────┤
│ ┌─────────────┐ ┌──────────────────┐ │
│ │ Query Agent │ │ Product Search │ │
│ │ │ │ Agent + Fast DB │ │
│ └─────────────┘ └──────────────────┘ │
│ ┌─────────────┐ ┌──────────────────┐ │
│ │ Review │ │ Deal Finder │ │
│ │ Analyzer │ │ Agent │ │
│ └─────────────┘ └──────────────────┘ │
└─────────────────────────────────────────┘
↓ Google Gemini AI
AI Processing & Response Generation
```

## 🚀 Quick Start

### Prerequisites
- Python 3.8+
- Node.js 18+
- Google AI API Key

### Backend Setup

1. **Clone and navigate to backend**:
```bash
cd cogni-cart/backend
```

2. **Create virtual environment**:
```bash
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
```

3. **Install dependencies**:
```bash
pip install -r requirements.txt
```

4. **Set up environment variables**:
```bash
# Create .env file
echo "GOOGLE_API_KEY=your_google_api_key_here" > .env
echo "MODEL_NAME=gemini-1.5-flash" >> .env
```

5. **Start the backend**:
```bash
python run.py
```

Backend will be available at `http://localhost:8000`

### Frontend Setup

1. **Navigate to frontend**:
```bash
cd ../frontend
```

2. **Install dependencies**:
```bash
npm install
```

3. **Start development server**:
```bash
npm run dev
```

Frontend will be available at `http://localhost:3000`

## 📡 API Endpoints

### Main Search Endpoint
```bash
POST /search
{
"query": "wireless earbuds under 3000 rupees",
"conversation_context": []
}
```

**Response**: Instant results with real Indian products!

### Product Comparison
```bash
POST /compare
{
"product_ids": ["product1", "product2"]
}
```

### Product Details
```bash
POST /product-details
{
"product_id": "fast_db_abc123"
}
```

### Health Check
```bash
GET /agents-status
```

## 🎯 Example Queries

Try these natural language queries:

- **"wireless earbuds under 3000 rupees"** → boAt Airdopes 141 (₹1,299)
- **"laptop under 50000 rupees"** → Dell Inspiron i5 (₹47,990)
- **"Samsung smartphone with good camera"** → Galaxy M34 5G (₹17,999)
- **"noise cancelling headphones"** → Sony WH-CH720N (₹8,990)
- **"budget smartwatch under 5000"** → Fire-Boltt Phoenix Pro (₹2,799)

## 🛠️ Technology Stack

**Backend:**
- **FastAPI**: Modern Python web framework
- **Google Gemini AI**: Advanced language model for natural language processing
- **Fast Product Database**: Optimized in-memory database with real Indian products
- **Pydantic**: Data validation and serialization

**Frontend:**
- **Next.js 14**: React framework with App Router
- **TypeScript**: Type-safe development
- **Shadcn UI**: Modern component library
- **Lucide Icons**: Beautiful icon set
- **Tailwind CSS**: Utility-first styling

## 📊 Performance

- **Search Response Time**: < 0.5 seconds
- **Database Lookup**: Sub-second
- **AI Processing**: 2-5 seconds
- **Success Rate**: 100% with fallbacks
- **Product Coverage**: 20+ real Indian products across 5 categories

## 🔧 Configuration

### Environment Variables

**Backend (.env)**:
```env
GOOGLE_API_KEY=your_google_api_key_here
MODEL_NAME=gemini-1.5-flash # or gemini-1.5-pro
```

### Supported AI Models
- `gemini-1.5-flash` (default) - Fast responses
- `gemini-1.5-pro` - More detailed analysis
- `gemini-1.0-pro` - Stable version

## 🚀 Production Deployment

### Backend (FastAPI)
```bash
# Install production dependencies
pip install gunicorn

# Run with Gunicorn
gunicorn main:app -w 4 -k uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000
```

### Frontend (Next.js)
```bash
# Build for production
npm run build

# Start production server
npm start
```

## 📈 Future Enhancements

- [ ] **Live Price Updates**: Real-time pricing from multiple retailers
- [ ] **Image Search**: Product search using images
- [ ] **Price History**: Track price changes over time
- [ ] **User Preferences**: Personalized recommendations
- [ ] **Voice Search**: Natural language voice queries
- [ ] **More Categories**: Books, clothing, home appliances
- [ ] **Regional Support**: Multiple Indian languages

## 🤝 Contributing

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## 📄 License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## 🙏 Acknowledgments

- **Google Gemini AI** for powerful language processing
- **Indian E-commerce Platforms** for product data inspiration
- **Open Source Community** for amazing tools and libraries

---

**Built with ❤️ for the Indian e-commerce market**

*Fast • Reliable • AI-Powered • Real Products*