A natural language interface for querying a SQL database using AI. This application allows users to ask questions about receipt data in plain English and get SQL-powered responses.
- Natural language interface for database queries
- Real-time table visualization
- Powered by Groq's Llama 3.3 70B model
- Simple and intuitive Gradio web interface
- Python 3.8+
- Groq API key
- Clone the repository:
git clone <repository-url>
cd smolagent-text-to-sql- Install dependencies:
pip install -r requirements.txt- Create a
.envfile in the root directory and add your Groq API key:
GROQ_API_KEY=your_api_key_here
- Initialize the database:
python init_db.py- Start the application:
python app.py-
Open your web browser and navigate to the URL shown in the terminal (typically http://127.0.0.1:7860)
-
Ask questions about the receipts data in natural language, such as:
- "Who had the most expensive receipt?"
- "What was the average tip amount?"
- "Show me all receipts above $20"
The application uses a simple receipts table with the following structure:
| Column | Type | Description |
|---|---|---|
| receipt_id | Integer | Primary key |
| customer_name | String | Customer's name |
| price | Float | Receipt amount |
| tip | Float | Tip amount |