A conversational AI-powered assistant that allows users to query relational databases using natural language β no SQL knowledge required! Built using LangChain, OpenAI, and MySQL, this system bridges the gap between non-technical users and structured data access.
- π Query relational databases using plain English
- π§ Converts natural language to SQL using LangChain + OpenAI
- ποΈ Executes real-time queries on a MySQL database
- π¬ Provides natural language responses and displays SQL on request
- π Maintains session-based chat history
- π οΈ Handles errors and unclear queries with clarification prompts
- Python 3.8+
- MySQL Server
- OpenAI API key
- (Optional) LangChain key if applicable
git clone https://github.com/your-username/database-query-assistant.git
cd database-query-assistant
pip install -r requirements.txtUpdate config.py with:
OPENAI_API_KEY = "your_openai_key"
DATABASE = {
"host": "localhost",
"user": "your_db_user",
"password": "your_password",
"database": "your_db_name"
}Run the application:
python app.pyAccess the interface at http://localhost:5000.
- Manual backend SQL verification using MySQL Workbench
- Query response validation through UI
- Chat history and clarification tested across multiple sessions
| Bug ID | Description | Status |
|---|---|---|
| BUG-001 | No error message on incorrect DB credentials | Fixed |
| BUG-002 | Some chat histories fail to load completely | Under Fix |
- π Multi-turn conversation support
- ποΈ Voice input capabilities
- π Data visualization integration
- π Role-based access control
- π Cross-database compatibility (PostgreSQL, NoSQL)