{"id":31074257,"url":"https://github.com/ashmit-kumar/unthinkable_assignment","last_synced_at":"2025-09-16T02:13:12.821Z","repository":{"id":312645756,"uuid":"1048031721","full_name":"Ashmit-Kumar/unthinkable_assignment","owner":"Ashmit-Kumar","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-01T04:08:21.000Z","size":149,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-01T06:46:10.240Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ashmit-Kumar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-31T19:04:51.000Z","updated_at":"2025-09-01T04:08:25.000Z","dependencies_parsed_at":"2025-09-01T06:46:21.405Z","dependency_job_id":"cceced25-e894-4fee-a240-07275a1c5766","html_url":"https://github.com/Ashmit-Kumar/unthinkable_assignment","commit_stats":null,"previous_names":["ashmit-kumar/unthinkable_assignment"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Ashmit-Kumar/unthinkable_assignment","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ashmit-Kumar%2Funthinkable_assignment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ashmit-Kumar%2Funthinkable_assignment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ashmit-Kumar%2Funthinkable_assignment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ashmit-Kumar%2Funthinkable_assignment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ashmit-Kumar","download_url":"https://codeload.github.com/Ashmit-Kumar/unthinkable_assignment/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ashmit-Kumar%2Funthinkable_assignment/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275348511,"owners_count":25448626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-16T02:00:10.229Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-09-16T02:13:11.629Z","updated_at":"2025-09-16T02:13:12.801Z","avatar_url":"https://github.com/Ashmit-Kumar.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🛒 Voice Shopping Assistant\n\nA modern **AI-powered voice shopping assistant** that lets users manage their shopping lists through natural speech commands. Built with **FastAPI**, **Groq LLMs**, **AssemblyAI speech recognition**, and a responsive web interface.\n\n![Voice Shopping Assistant](https://img.shields.io/badge/AI-Powered-blue) ![FastAPI](https://img.shields.io/badge/FastAPI-0.104.1-green) ![Docker](https://img.shields.io/badge/Docker-Ready-blue) ![License](https://img.shields.io/badge/License-MIT-yellow)\n\n---\n\n## ✨ Features\n\n### 🎤 **Voice-First Experience**\n- **Natural Speech Commands**: Say \"Add 2 liters of milk\" or \"Remove apples from my list\"\n- **Real-time Processing**: Speech → Text (AssemblyAI) → Structured Actions (Groq AI)\n- **Smart Confirmation**: Visual confirmation before executing voice commands\n\n### 🧠 **AI-Powered Intelligence**\n- **LLM Command Parsing**: Groq's `llama-3.3-70b-versatile` extracts product, quantity, category, and action\n- **Fuzzy Product Matching**: Handles variations in product names using RapidFuzz\n- **Text Normalization**: Understands different ways of expressing shopping intents\n\n### 📱 **Modern Web Interface**\n- **Responsive Design**: Works seamlessly on desktop, tablet, and mobile\n- **Real-time Updates**: Live wishlist and recommendations without page refresh\n- **Visual Feedback**: Loading states, notifications, and confirmation dialogs\n- **Offline Support**: Graceful handling of network connectivity issues\n\n### 🤖 **Smart Recommendations**\n- **ML-Based Suggestions**: Uses SentenceTransformers + FAISS for semantic product matching\n- **Personalized Results**: Recommendations based on shopping history and preferences\n- **Category-Aware**: Prioritizes items from similar categories\n- **Stock-Aware**: Only suggests available products\n\n### 🐳 **Production Ready**\n- **Docker Support**: Separate containers for frontend and backend\n- **EC2 Deployment**: Ready-to-deploy configuration for AWS EC2\n- **Environment Management**: Secure API key and configuration handling\n- **Scalable Architecture**: Microservices-ready design\n\n---\n\n## 🏗️ Architecture\n\n```\n┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐\n│   Frontend      │    │    Backend      │    │    Database     │\n│   (Nginx)       │◄──►│   (Python)      │◄──►│   (MongoDB)     │\n│   Port: 3232    │    │   Port: 5000    │    │   Atlas/Local   │\n└─────────────────┘    └─────────────────┘    └─────────────────┘\n         │                       │                       │\n         ▼                       ▼                       ▼\n┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐\n│ • Vanilla JS    │    │ • FastAPI       │    │ • User Wishlists│\n│ • HTML/CSS      │    │ • Speech-to-Text│    │ • Store Products│\n│ • Voice Recording│    │ • AI Processing │    │ • Shopping History│\n│ • Real-time UI  │    │ • Recommendations│    │ • Vector Search │\n└─────────────────┘    └─────────────────┘    └─────────────────┘\n```\n\n---\n\n## 📂 Project Structure\n\n```\nvoice-shopping-assistant/\n├── 🐳 Docker Configuration\n│   ├── Dockerfile.backend          # Python FastAPI container\n│   ├── Dockerfile.frontend         # Nginx static file server\n│   ├── docker-compose.yml          # Local development setup\n│   └── nginx.conf                  # Nginx configuration\n│\n├── 🖥️ Backend (Python)\n│   ├── main.py                     # FastAPI application \u0026 routes\n│   ├── db.py                       # MongoDB connection \u0026 collections\n│   ├── helper_function.py          # Utility functions \u0026 validation\n│   ├── prompt.py                   # Groq AI integration\n│   ├── seed_store.py              # Sample store data\n│   └── requirements.txt            # Python dependencies\n│\n├── 🌐 Frontend (Web)\n│   ├── index.html                  # Main application interface\n│   ├── css/\n│   │   ├── main.css               # Core styles \u0026 layout\n│   │   ├── components.css         # UI component styles\n│   │   └── responsive.css         # Mobile-responsive design\n│   └── js/\n│       ├── app.js                 # Main application logic\n│       ├── api.js                 # API communication layer\n│       ├── audio.js               # Voice recording functionality\n│       └── ui.js                  # UI management \u0026 interactions\n│\n├── ⚙️ Configuration\n│   ├── .env                       # Environment variables (local)\n│   ├── .env.example              # Environment template\n│   ├── .dockerignore             # Docker build exclusions\n│   └── .gitignore                # Git exclusions\n│\n└── 📚 Documentation\n    ├── README.md                  # This file\n    └── DOCKER_README.md          # Docker deployment guide\n```\n\n---\n\n## 🚀 Quick Start\n\n### 🐳 **Docker Deployment (Recommended)**\n\n1. **Clone the repository**\n   ```bash\n   git clone https://github.com/Ashmit-Kumar/unthinkable_assignment\n   cd voice-shopping-assistant\n   ```\n\n2. **Configure environment**\n   ```bash\n   cp .env.example .env\n   # Edit .env with your API keys\n   ```\n\n3. **Build and run**\n   ```bash\n   docker-compose up --build -d\n   ```\n\n4. **Access the application**\n   - **Frontend**: http://localhost:3232\n   - **Backend API**: http://localhost:5000\n   - **API Documentation**: http://localhost:5000/docs\n\n### � F**Local Development**\n\n1. **Backend Setup**\n   ```bash\n   pip install -r requirements.txt\n   uvicorn main:app --host 0.0.0.0 --port 5000 --reload\n   ```\n\n2. **Frontend Setup**\n   ```bash\n   cd frontend\n   python -m http.server 3232\n   # Or use any static file server\n   ```\n\n---\n\n## 🔧 Configuration\n\n### 📋 **Environment Variables**\n\nCreate a `.env` file with the following variables:\n\n```env\n# Groq API Key (get from https://console.groq.com/)\nGROQ_API_KEY=gsk_your_groq_api_key_here\n\n# AssemblyAI API Key (get from https://www.assemblyai.com/)\nASSEMBLYAI_API_KEY=your_assemblyai_api_key_here\n\n# MongoDB Connection String\nMONGO_URI=mongodb+srv://username:password@cluster.mongodb.net/database_name\n# Or for local MongoDB:\n# MONGO_URI=mongodb://localhost:27017\n```\n\n### 🗄️ **Database Setup**\n\nThe application uses MongoDB with two main collections:\n\n- **`users`**: Stores user wishlists and shopping history\n- **`store`**: Contains available products with categories and stock\n\nSample store data is automatically seeded when you run `seed_store.py`.\n\n---\n\n## 🎯 API Endpoints\n\n### 🎤 **Voice Processing**\n- `POST /recognise_text_to_llm` - Process voice recording and return structured command\n\n### 📝 **Wishlist Management**\n- `GET /wishlist/{username}` - Get user's current wishlist\n- `POST /update_wishlist/{username}` - Add/remove items from wishlist\n\n### 💡 **Recommendations**\n- `GET /recommendations/{username}` - Get personalized product recommendations\n\n### 📊 **API Documentation**\n- `GET /docs` - Interactive Swagger UI documentation\n- `GET /redoc` - ReDoc API documentation\n\n---\n\n## 🎤 Usage Examples\n\n### **Voice Commands**\n\n| Command | Action | Result |\n|---------|--------|--------|\n| \"Add milk to my list\" | Add item | Adds milk (quantity: 1) |\n| \"I need 2 apples\" | Add item | Adds apples (quantity: 2) |\n| \"Remove bananas\" | Remove item | Removes bananas from list |\n| \"Delete chocolate from my list\" | Remove item | Removes chocolate |\n\n### **API Usage**\n\n```javascript\n// Get user's wishlist\nconst response = await fetch('/wishlist/john_doe');\nconst data = await response.json();\n\n// Add item to wishlist\nconst addAction = {\n    product: \"Apple\",\n    quantity: 2,\n    category: \"fruit\",\n    action: \"add\",\n    status: \"manual_add\"\n};\n\nawait fetch('/update_wishlist/john_doe', {\n    method: 'POST',\n    headers: { 'Content-Type': 'application/json' },\n    body: JSON.stringify(addAction)\n});\n```\n\n---\n\n## 🐳 Docker Deployment\n\n### **Build Images**\n```bash\n# Build backend image\ndocker build -f Dockerfile.backend -t voice-shopping-backend:latest .\n\n# Build frontend image  \ndocker build -f Dockerfile.frontend -t voice-shopping-frontend:latest .\n```\n\n### **Run with Docker Compose**\n```bash\n# Development\ndocker-compose up --build -d\n\n# Production (with pre-built images)\ndocker-compose -f docker-compose.prod.yml up -d\n```\n\n### **AWS EC2 Deployment**\n```bash\n# On EC2 instance\ngit clone \u003cyour-repo\u003e\ncd voice-shopping-assistant\n\n# Configure environment\ncp .env.example .env\nnano .env  # Add your API keys\n\n# Deploy\ndocker-compose up --build -d\n```\n\n**Security Group Configuration:**\n- Port 3232: Frontend access\n- Port 5000: Backend API\n- Port 22: SSH access\n\n---\n\n## 🧠 AI \u0026 ML Components\n\n### **Speech Recognition**\n- **Provider**: AssemblyAI\n- **Language**: English (en)\n- **Format**: WebM audio from browser\n\n### **Language Model**\n- **Provider**: Groq\n- **Model**: `llama-3.3-70b-versatile`\n- **Purpose**: Parse natural language into structured shopping commands\n\n### **Recommendation Engine**\n- **Embeddings**: SentenceTransformers (`all-MiniLM-L6-v2`)\n- **Vector Search**: FAISS (Facebook AI Similarity Search)\n- **Strategy**: Semantic similarity + category boosting + stock filtering\n\n### **Text Processing**\n- **Fuzzy Matching**: RapidFuzz for product name variations\n- **Normalization**: Regex-based intent recognition\n- **Validation**: Schema validation for AI responses\n\n---\n\n## 🔒 Security Features\n\n- **Input Validation**: All user inputs are validated and sanitized\n- **API Key Management**: Environment-based configuration\n- **CORS Protection**: Configurable cross-origin resource sharing\n- **Error Handling**: Graceful error responses without exposing internals\n- **Non-root Containers**: Docker containers run with non-privileged users\n\n---\n\n## 📊 Performance \u0026 Scalability\n\n- **Async Processing**: FastAPI with async/await for concurrent requests\n- **Vector Indexing**: FAISS for fast similarity search\n- **Connection Pooling**: MongoDB connection management\n- **Caching**: Browser-side caching for static assets\n- **Compression**: Gzip compression for API responses\n\n---\n\n## 🛠️ Development\n\n### **Prerequisites**\n- Python 3.11+\n- Node.js (for frontend development)\n- Docker \u0026 Docker Compose\n- MongoDB (local or Atlas)\n\n### **Development Workflow**\n```bash\n# Backend development\npip install -r requirements.txt\nuvicorn main:app --reload --port 5000\n\n# Frontend development\ncd frontend\npython -m http.server 3232\n\n# Run tests\npython -m pytest tests/\n\n# Code formatting\nblack *.py\n```\n\n### **Adding New Features**\n1. Update API endpoints in `main.py`\n2. Add frontend functionality in `js/app.js`\n3. Update UI components in `js/ui.js`\n4. Add styles in appropriate CSS files\n5. Update documentation\n\n---\n\n## 🚀 Deployment Options\n\n### **Local Development**\n- Direct Python execution\n- Local MongoDB instance\n- Static file server for frontend\n\n### **Docker Compose**\n- Containerized backend and frontend\n- Nginx reverse proxy\n- Environment-based configuration\n\n### **Cloud Deployment**\n- **AWS EC2**: Full Docker deployment\n- **Heroku**: Backend deployment with static frontend\n- **Vercel/Netlify**: Frontend deployment with API proxy\n- **MongoDB Atlas**: Managed database service\n\n---\n\n## 🔮 Future Enhancements\n\n### **Planned Features**\n- [ ] **Multi-language Support**: Support for multiple languages in speech recognition\n- [ ] **User Authentication**: Login/signup with JWT tokens\n- [ ] **Shopping Lists**: Multiple named lists per user\n- [ ] **Price Tracking**: Historical price data and alerts\n- [ ] **Barcode Scanning**: Mobile app with barcode integration\n- [ ] **Voice Synthesis**: Text-to-speech responses\n- [ ] **Real-time Collaboration**: Shared family shopping lists\n\n### **Technical Improvements**\n-  **Caching Layer**: Redis for session and recommendation caching\n-  **Message Queue**: Celery for background processing\n-  **Monitoring**: Prometheus + Grafana for metrics\n-  **Testing**: Comprehensive test suite with pytest\n-  **CI/CD**: GitHub Actions for automated deployment\n-  **Load Balancing**: Multiple backend instances\n\n---\n\n## 🤝 Contributing\n\nWe welcome contributions! Please follow these steps:\n\n1. **Fork the repository**\n2. **Create a feature branch**: `git checkout -b feature/amazing-feature`\n3. **Make your changes** and add tests\n4. **Commit your changes**: `git commit -m 'Add amazing feature'`\n5. **Push to the branch**: `git push origin feature/amazing-feature`\n6. **Open a Pull Request**\n\n### **Development Guidelines**\n- Follow PEP 8 for Python code\n- Use meaningful commit messages\n- Add tests for new features\n- Update documentation as needed\n- Ensure Docker builds work correctly\n\n---\n\n## 📝 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n---\n\n## 🙏 Acknowledgments\n\n- **AssemblyAI** for speech recognition services\n- **Groq** for fast LLM inference\n- **Sentence Transformers** for semantic embeddings\n- **FAISS** for efficient vector search\n- **FastAPI** for the excellent web framework\n- **MongoDB** for flexible document storage\n\n---\n\n## 📞 Support\n\n- **Issues**: [GitHub Issues](https://github.com/Ashmit-Kumar/unthinkable_assignment/issues)\n- **Discussions**: [GitHub Discussions](https://github.com/Ashmit-Kumar/unthinkable_assignment/discussions)\n- **Email**: ashmitkumar1020@gmail.com\n\n---\n\n**Built with ❤️ for smarter shopping experiences**","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashmit-kumar%2Funthinkable_assignment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fashmit-kumar%2Funthinkable_assignment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashmit-kumar%2Funthinkable_assignment/lists"}