{"id":28436574,"url":"https://github.com/lprabodha/auto-sales-chatbot","last_synced_at":"2026-04-17T11:31:50.082Z","repository":{"id":293868090,"uuid":"954175761","full_name":"Lprabodha/auto-sales-chatbot","owner":"Lprabodha","description":"AutoBot – Intelligent Chatbot for Auto Sales","archived":false,"fork":false,"pushed_at":"2025-05-25T13:50:09.000Z","size":16179,"stargazers_count":1,"open_issues_count":8,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-27T19:41:17.629Z","etag":null,"topics":["chatbot","conversational-ai","fastapi","mongodb","nlp","pytorch","vehicle-search"],"latest_commit_sha":null,"homepage":"https://auto-sales-chatbot.vercel.app/","language":"Python","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/Lprabodha.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}},"created_at":"2025-03-24T17:15:02.000Z","updated_at":"2025-05-25T13:50:12.000Z","dependencies_parsed_at":"2025-06-27T19:37:35.299Z","dependency_job_id":"c257eb65-f305-40f6-9b72-9c16aaac1fbb","html_url":"https://github.com/Lprabodha/auto-sales-chatbot","commit_stats":null,"previous_names":["lprabodha/auto-sales-chatbot"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Lprabodha/auto-sales-chatbot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lprabodha%2Fauto-sales-chatbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lprabodha%2Fauto-sales-chatbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lprabodha%2Fauto-sales-chatbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lprabodha%2Fauto-sales-chatbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lprabodha","download_url":"https://codeload.github.com/Lprabodha/auto-sales-chatbot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lprabodha%2Fauto-sales-chatbot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31927720,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T10:35:34.458Z","status":"ssl_error","status_checked_at":"2026-04-17T10:35:09.472Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["chatbot","conversational-ai","fastapi","mongodb","nlp","pytorch","vehicle-search"],"created_at":"2025-06-05T22:09:32.092Z","updated_at":"2026-04-17T11:31:50.065Z","avatar_url":"https://github.com/Lprabodha.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# 🚗 AutoBot – Intelligent Chatbot for Auto Sales\n![Python](https://img.shields.io/badge/python-3.13-blue)\n![FastAPI](https://img.shields.io/badge/FastAPI-ready-green)\n![Open Source](https://img.shields.io/badge/license-MIT-green)\n![PyTorch](https://img.shields.io/badge/PyTorch-Enabled-EE4C2C?logo=pytorch)\n![MongoDB](https://img.shields.io/badge/MongoDB-Integrated-brightgreen?logo=mongodb)\n![Contributions Welcome](https://img.shields.io/badge/contributions-welcome-orange.svg)\n![Made With Love](https://img.shields.io/badge/Made%20with-%E2%9D%A4-red)\n\n\nAutoBot is an AI-powered chatbot built using **PyTorch**, **FastAPI**, and **MongoDB** that helps users search and filter vehicles intelligently. It can handle queries related to brands, models, fuel types, price ranges, and more, and supports feedback collection for continuous improvement via scheduled model retraining.\n\n---\n\n## 🚀 Features\n\n- 🔍 **Natural Language Understanding** for vehicle queries (e.g., *“Show me Toyota Vitz under 5 million”*)\n- 📊 **Price, model, brand, and type filters** with fuzzy matching\n- 💬 **Interactive Chat Mode** or REST API\n- 🧠 **ML Model Training** with intent classification using PyTorch\n- ♻️ **Daily Retraining from Feedback** (admin-reviewed)\n- 📈 **Feedback Logging** with thumbs up/down reactions\n- 📂 **MongoDB Integration** for vehicle data and feedback history\n\n---\n\n## 🧰 Tech Stack\n\n- **Python 3.12+**\n- **PyTorch**\n- **FastAPI**\n- **MongoDB**\n- **Uvicorn** (for dev server)\n- **scikit-learn** (metrics)\n- **matplotlib** (for training metrics)\n\n---\n\n## 📁 Folder Structure\n\n```\nauto_sales_bot/\n│\n├── data/\n│   └── intents.json              # Training intents\n├── models/\n│   └── model.pth                 # Saved PyTorch model\n├── utils/\n│   └── preprocessing.py          # Preprocessing utils\n├── api.py                        # FastAPI endpoint\n├── chatbot.py                    # Chat logic \u0026 ML inference\n├── train.py                      # Training script\n├── retrain_daily.py              # Scheduled retraining\n├── mongo_service.py              # MongoDB interface\n└── requirements.txt              # Dependencies\n```\n\n---\n\n## ⚙️ Setup Instructions\n\n### 1. Clone the repository\n\n```bash\ngit clone https://github.com/Lprabodha/auto-sales-chatbot\ncd auto_sales_bot\n\ngit clone https://github.com/Lprabodha/auto-sales-chatbot-widget\n```\n\n### 2. Create \u0026 activate a virtual environment\n\n```bash\npython -m venv .venv\nsource .venv/bin/activate\n```\n\n### 3. Install dependencies\n\n```bash\npip install -r requirements.txt\n```\n\n### 4. Start MongoDB\n\nEnsure MongoDB is running locally at `mongodb://localhost:27017`. Use Docker or install MongoDB natively.\n\n  #### Sample Data \u0026 Retraining\n\n    🚗 Sample vehicle listings JSON: data/sample_vehicles.json\n\n  #### Import Sample Data to MongoDB\n\n  ```\n  mongoimport --uri \"mongodb://localhost:27017\" \\\n  --db auto_sales_bot \\\n  --collection vehicles \\\n  --file data/sample_vehicles.json \\\n  --jsonArray\n  ```\n\n### 5. Configure your .env file\n```\nMONGO_URI=mongodb://localhost:27017\nDB_NAME=auto_sales_bot\nMODEL_PATH=models/model.pth\nSECRET_KEY=your-secret-key\n```\n\n### 6. Train the model (initial run)\n\n```bash\npython train.py\n```\n\n### 7. Start the API\n\n```bash\nuvicorn api:app --reload\n```\n\n---\n\n## 📬 API Endpoints\n\n### `POST /chat`\n\n**Request:**\n```json\n{ \"query\": \"Show me Toyota Vitz under 5 million\" }\n```\n\n**Response:**\n```json\n{\n  \"response\": \"Here are some Toyota Vitz available:\",\n  \"prob\": 0.97,\n  \"intent\": \"ask_brand_model\",\n  \"suggestions\": [\n    {\n      \"id\": 1,\n      \"model_name\": \"Vitz 2019\",\n      \"vehicle_name\": \"Toyota Vitz\",\n      \"year\": 2019,\n      \"price\": 9500000,\n      \"mileage\": 60000\n    }\n  ]\n}\n```\n\n### `POST /feedback`\n\n**Request:**\n```json\n{\n  \"query\": \"Any Toyota cars under 4 million?\",\n  \"response\": \"Here are some Toyota available:\",\n  \"predicted_intent\": \"ask_price_range\",\n  \"prob\": 0.91,\n  \"thumbs_up\": false\n}\n```\n\n### `POST /retrain-now`\n\nForces model retraining based on feedback data (after admin update).\n\n---\n\n## ⏰ Automating Daily Retraining\n\nUse a cron job or scheduler to run the retrain script:\n\n```bash\n0 0 * * * cd /path/to/project \u0026\u0026 .venv/bin/python retrain_daily.py\n```\n\nThis will:\n- Update `intents.json` from admin-approved feedback\n- Retrain the model if required\n- Save the updated model\n\n---\n\n## ✨ Contributions\n\nFeel free to open issues or PRs for new features, model improvements, or bug fixes.\n\n---\n\n## 👨‍💻 Authors\n\n- Dewmina Udayashan \n- Lahiru Prabodha\n\n---\n\nHappy coding! 😊\n\n---\n\n## 📜 License\n\nMIT License. See `LICENSE` file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flprabodha%2Fauto-sales-chatbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flprabodha%2Fauto-sales-chatbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flprabodha%2Fauto-sales-chatbot/lists"}