ChatDB is a Python application that lets you ask natural language questions about a SQLite music store database. It uses OpenAI's GPT-4o model to interpret your questions and provide answers based on the database schema and sample data.
- Connects to a local SQLite database (
chinook.sqlite) - Automatically fetches schema and sample data from all tables
- Uses OpenAI GPT-4o for natural language Q&A
- Interactive chat interface powered by Chainlit
- Python 3.8+
- Chainlit
- OpenAI Python SDK
chinook.sqlitedatabase file in the project folder
- Clone the repository:
git clone https://github.com/mathncode-sid/chat_DB.git cd chat_DB - Install dependencies:
pip install -r requirements.txt
-
Place your chinook.sqlite file in the project directory.
-
Set your OpenAI API key as an environment variable:
export OPENAI_API_KEY=your-api-key
- Start the Chainlit app:
chainlit run app.py
- Open the provided URL in your browser and start asking questions about the database, such as: "List the top 5 artists by album count." "What genres are available in the store?" The AI is tailored to only answer questions from the Database
i) app.py — Main application logic
ii) chinook.sqlite — SQLite database file
iii) requirements.txt — Python dependencies
- Expand core chat features and improve user experience
- Integrate new database options and optimize existing queries
- Add advanced user authentication and role management
- Enhance testing coverage and automation
- Improve documentation with usage examples and deployment guides
- Explore deployment to cloud platforms and containerization