P-Karthik-Mohan commited on
Commit
4423519
Β·
1 Parent(s): 7f0d0a6

Fix README yaml metadata

Browse files
Files changed (1) hide show
  1. README.md +72 -0
README.md CHANGED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: SQL Analyst OpenEnv
3
+ emoji: πŸ“Š
4
+ colorFrom: blue
5
+ colorTo: green
6
+ sdk: docker
7
+ pinned: false
8
+ ---
9
+
10
+ # SQL Analyst OpenEnv
11
+
12
+ A real-world OpenEnv environment where an AI agent writes SQL queries against an e-commerce database to answer business questions.
13
+
14
+ ## Tasks
15
+
16
+ | ID | Difficulty | Description |
17
+ |----|-----------|-------------|
18
+ | 1 | Easy | Count completed orders in 2024 |
19
+ | 2 | Medium | Top 5 customers by revenue (JOIN + GROUP BY) |
20
+ | 3 | Hard | Category revenue ranking (CTE + window function) |
21
+
22
+ ## API Endpoints
23
+
24
+ - `POST /reset` β€” load a task
25
+ - `POST /step` β€” submit a SQL query, get reward 0.0–1.0
26
+ - `GET /state` β€” current session state
27
+ - `GET /docs` β€” interactive API documentation
28
+
29
+ ## Quick Start
30
+
31
+ ```bash
32
+ # Reset to task 1
33
+ curl -X POST https://p-karthik-mohan-sql-analyst-env.hf.space/reset \
34
+ -H "Content-Type: application/json" \
35
+ -d '{"task_id": 1}'
36
+
37
+ # Submit a SQL query
38
+ curl -X POST https://p-karthik-mohan-sql-analyst-env.hf.space/step \
39
+ -H "Content-Type: application/json" \
40
+ -d '{"action": "SELECT COUNT(*) AS total_orders FROM orders WHERE status = 'completed'"}'
41
+ ```
42
+
43
+ ## Reward Function
44
+
45
+ Partial credit scoring β€” 0.0 to 1.0:
46
+
47
+ - **0.30** β€” correct column names
48
+ - **0.30** β€” correct row count
49
+ - **0.40** β€” correct cell values
50
+
51
+ ## Running inference.py
52
+
53
+ ```bash
54
+ export API_BASE_URL=https://api.openai.com/v1
55
+ export MODEL_NAME=gpt-4o-mini
56
+ export HF_TOKEN=your_api_key_here
57
+ python inference.py
58
+ ```
59
+
60
+ ## Database Schema
61
+
62
+ ```
63
+ customers (customer_id, first_name, last_name, email, city, signup_date) β€” 100 rows
64
+ products (product_id, product_name, category, price, stock) β€” 30 rows
65
+ orders (order_id, customer_id, product_id, quantity, total_amount, order_date, status) β€” 600 rows
66
+ ```
67
+
68
+ ## Hardware Requirements
69
+
70
+ - 2 vCPU, 8GB RAM minimum
71
+ - No GPU required
72
+ - SQLite β€” no external database needed