An intelligent chatbot that allows users to query product and supplier data using natural language. Built with React (frontend), FastAPI (backend), and integrated with OpenAI for data summarization.
- Natural Language Queries: Ask questions like:
- "Show me all products under brand X"
- "Which suppliers provide laptops?"
- Supplier Data Summarization: Enhanced responses using LLM (OpenAI GPT-3.5/4).
- Product & Supplier Search: Query structured data from MySQL/PostgreSQL.
- Responsive UI: Modern chat interface with query history panel.
- REST API: Fully documented endpoints with Swagger UI.
# Clone the repository
git clone https://github.com/yourusername/ai-chatbot.git
cd ai-chatbot/chatbot-backend
# Create and activate virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Set up environment variables
cp .env.example .env # Update values in .envcd ../chatbot-frontend
npm install-
Database: Update
.envwith your MySQL/PostgreSQL credentials:DATABASE_URL=mysql+pymysql://user:password@localhost:3306/chatbot_db
-
OpenAI: Add your API key for LLM features:
OPENAI_API_KEY=your_api_key_here
-
Initialize Database:
-- Run via MySQL Workbench or CLI CREATE DATABASE chatbot_db; USE chatbot_db; SOURCE database/init.sql;
-
Start Backend:
cd chatbot-backend uvicorn app.main:app --reload -
Start Frontend:
cd chatbot-frontend npm run dev -
Access the chatbot at
http://localhost:5173.
Interactive documentation available at http://localhost:8000/docs:
| Endpoint | Method | Description |
|---|---|---|
/api/v1/products/{brand} |
GET | Get products by brand |
/api/v1/suppliers/{category} |
GET | Get suppliers by product category |
/api/v1/suppliers/{id}/summary |
GET | Get LLM-summarized supplier info |
Example Response:
{
"summary": "Supplier A specializes in Electronics and Laptops. Contact: contact@supplierA.com"
}-
Backend:
Deploy to Render or AWS EC2 with:docker build -t chatbot-backend . -
Database: Use PlanetScale or AWS RDS.
- Fork the repository
- Create a feature branch (
git checkout -b feature/your-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/your-feature) - Open a Pull Request
MIT License - see LICENSE
Need Help?
Open an issue or contact krdevanshu06@rediffmail.com
- Clear installation instructions
- Badges for tech stack visibility
- API documentation table
- One-click deployment buttons
- Mobile-responsive formatting
- License and contribution guidelines