A smart AI-powered conversational agent that answers complex business questions from a SQL database using natural language and auto-generated charts & tables.
![demo]..........................
🌐 [View Live App].............
Layer | Technology |
---|---|
Frontend | React, Tailwind (or other UI) |
Backend | Node.js, Express |
AI Agent | OpenAI GPT (chat/completion) |
Database | SQLite |
Charts | Chart.js / Recharts |
ai-data-agent/
├── ai-agent-frontend/ # React frontend (UI)
├── ai-agent-backend/ # Node + Express + SQLite + OpenAI
│ ├── db/
│ │ └── test.db # Sample complex database
│ ├── .env # API key config
│ ├── index.js # Backend server
│ └── package.json
├── README.md
└── screenshots/ # UI demo images (optional)
- ✅ Ask vague or complex business questions
- ✅ Handles bad schema and messy table/column names
- ✅ Generates natural language answers
- ✅ Displays charts and tables
- ✅ Real-time answers using OpenAI + SQLite
These demonstrate its analytical capability beyond simple lookups.
- “Total transactions in May 2024?”
- “Show monthly revenue trend for the last year.”
- “Which customer segments had the highest churn?”
- “Compare profits between Q1 and Q2.”
- “List top 5 products by average order value.”
git clone https://github.com/yourusername/ai-data-agent.git
cd ai-data-agent
cd ai-agent-backend
npm install
Create a .env
file in ai-agent-backend
:
OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxx
Make sure the database file exists at ai-agent-backend/db/test.db
.
Run the backend:
node index.js
cd ../ai-agent-frontend
npm install
npm start
In ai-agent-backend/.env
:
OPENAI_API_KEY=your-openai-api-key
graph TD
User -->|Asks Question| ReactUI
ReactUI -->|POST /api/ask| ExpressBackend
ExpressBackend -->|Translate to SQL| OpenAI
OpenAI -->|Returns SQL + Answer| ExpressBackend
ExpressBackend -->|Query| SQLite
SQLite -->|Data| ExpressBackend
ExpressBackend -->|Answer + Chart| ReactUI
- ✅ Working full-stack web app
- ✅ Complex sample SQLite database
- ✅ Conversational AI Agent with accurate responses
- ✅ Charts and tables visualization
- ✅ Production-ready README
Mahboob Alam 📧 [email protected] 🔗 LinkedIn
If you found this useful, consider giving it a ⭐️ on GitHub. It really helps!