Spaces:
Sleeping
Sleeping
arthi.kasturirangan@informa.com commited on
Commit ·
e4b501b
1
Parent(s): 94404c6
readme
Browse files
README.md
CHANGED
|
@@ -9,3 +9,57 @@ short_description: SQL agent to converse with structured databases
|
|
| 9 |
---
|
| 10 |
|
| 11 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
---
|
| 10 |
|
| 11 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 12 |
+
|
| 13 |
+
# Text-to-SQL Agent API
|
| 14 |
+
|
| 15 |
+
A FastAPI backend service that converts natural language queries into SQL and provides intelligent data insights using LangGraph agents.
|
| 16 |
+
|
| 17 |
+
## Overview
|
| 18 |
+
|
| 19 |
+
This API service enables natural language querying of SQL databases through an AI-powered agent that:
|
| 20 |
+
- Converts text queries to SQL statements
|
| 21 |
+
- Executes queries safely on SQLite databases
|
| 22 |
+
- Provides intelligent data analysis and insights
|
| 23 |
+
- Offers conversational interface for data exploration
|
| 24 |
+
|
| 25 |
+
Built with FastAPI, LangGraph, and SQLAlchemy for high-performance data querying.
|
| 26 |
+
|
| 27 |
+
## Quick Start
|
| 28 |
+
|
| 29 |
+
### Prerequisites
|
| 30 |
+
- Python 3.8+
|
| 31 |
+
- OpenAI API key
|
| 32 |
+
|
| 33 |
+
### Installation
|
| 34 |
+
|
| 35 |
+
1. **Clone and setup:**
|
| 36 |
+
```bash
|
| 37 |
+
git clone https://github.com/arthikrangan/text-to-sql-agent-api.git
|
| 38 |
+
cd text-to-sql-agent-api
|
| 39 |
+
python -m venv .venv
|
| 40 |
+
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
2. **Install dependencies:**
|
| 44 |
+
```bash
|
| 45 |
+
pip install -r requirements.txt
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
3. **Configure environment:**
|
| 49 |
+
```bash
|
| 50 |
+
cp .env.example .env
|
| 51 |
+
# Edit .env and add your OPENAI_API_KEY
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
4. **Run the server:**
|
| 55 |
+
```bash
|
| 56 |
+
uvicorn app.main:app --reload
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
### Docker
|
| 61 |
+
```bash
|
| 62 |
+
# Build and run
|
| 63 |
+
docker build -t text-to-sql-api .
|
| 64 |
+
docker run -p 8000:8000 --env-file .env text-to-sql-api
|
| 65 |
+
```
|