Spaces:
Sleeping
Sleeping
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,114 +1,116 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: Meta-Pytorch-Openenv
|
| 3 |
-
emoji: π¦
|
| 4 |
-
colorFrom: blue
|
| 5 |
-
colorTo: green
|
| 6 |
-
sdk: docker
|
| 7 |
-
app_port: 7860
|
| 8 |
-
base_path: /web
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
| 20 |
-
|
|
| 21 |
-
| **
|
| 22 |
-
| **
|
| 23 |
-
| **
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
##
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
- 0.3 for
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
- 0.2 for
|
| 47 |
-
- 0.2 for
|
| 48 |
-
- 0.2 for
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
##
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
**
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
```
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
βββ
|
| 106 |
-
βββ
|
| 107 |
-
βββ
|
| 108 |
-
βββ
|
| 109 |
-
βββ
|
| 110 |
-
βββ
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Meta-Pytorch-Openenv
|
| 3 |
+
emoji: π¦
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: green
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_port: 7860
|
| 8 |
+
base_path: /web
|
| 9 |
+
tags:
|
| 10 |
+
- openenv
|
| 11 |
+
---
|
| 12 |
+
# SQL / Data Cleaning Sandbox
|
| 13 |
+
|
| 14 |
+
An **OpenEnv**-compliant environment where AI agents clean messy SQLite databases
|
| 15 |
+
using SQL queries and Python code.
|
| 16 |
+
|
| 17 |
+
## Overview
|
| 18 |
+
|
| 19 |
+
| Feature | Details |
|
| 20 |
+
|---|---|
|
| 21 |
+
| **Interface** | `step()` / `reset()` / `state()` |
|
| 22 |
+
| **Action space** | `{ tool: "sql" \| "python", command: "..." }` |
|
| 23 |
+
| **Observation** | `{ output, error, current_step, max_steps, task_description }` |
|
| 24 |
+
| **Reward** | 0.0 - 1.0 with **partial progress signals** |
|
| 25 |
+
| **Tasks** | 3 (easy, medium, hard) |
|
| 26 |
+
|
| 27 |
+
## Tasks
|
| 28 |
+
|
| 29 |
+
### Easy - Data Triage
|
| 30 |
+
> Find the total revenue from the `sales` table for January 2024.
|
| 31 |
+
|
| 32 |
+
**Grader**: Checks if the computed total matches the expected float value (1000.00).
|
| 33 |
+
|
| 34 |
+
### Medium - Data Cleaning
|
| 35 |
+
> Fix duplicate emails, NULL ages, and uppercase emails in the `users` table.
|
| 36 |
+
|
| 37 |
+
**Grader**: Partial scoring:
|
| 38 |
+
- 0.3 for all emails lowercase
|
| 39 |
+
- 0.4 for no duplicate emails
|
| 40 |
+
- 0.3 for no NULL ages
|
| 41 |
+
|
| 42 |
+
### Hard - Schema Migration
|
| 43 |
+
> Normalize `flat_orders` into `customers` + `orders` tables with foreign keys.
|
| 44 |
+
|
| 45 |
+
**Grader**: Partial scoring:
|
| 46 |
+
- 0.2 for correct `customers` schema
|
| 47 |
+
- 0.2 for correct `orders` schema
|
| 48 |
+
- 0.2 for 4 unique customers
|
| 49 |
+
- 0.2 for 6 orders migrated
|
| 50 |
+
- 0.2 for valid FK integrity
|
| 51 |
+
|
| 52 |
+
## Quick Start
|
| 53 |
+
|
| 54 |
+
### Local Development
|
| 55 |
+
|
| 56 |
+
1. **Clone and Install**
|
| 57 |
+
```bash
|
| 58 |
+
# Clone the repository
|
| 59 |
+
git clone https://github.com/shreyas231219/Meta-Pytorch-Openenv.git
|
| 60 |
+
cd Meta-Pytorch-Openenv
|
| 61 |
+
|
| 62 |
+
# Install dependencies
|
| 63 |
+
pip install -e .
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
2. **Run the Server**
|
| 67 |
+
The server will default to port **7860**.
|
| 68 |
+
|
| 69 |
+
**Bash (Linux/macOS):**
|
| 70 |
+
```bash
|
| 71 |
+
TASK_ID=easy python -m server.app
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
**PowerShell (Windows):**
|
| 75 |
+
```powershell
|
| 76 |
+
$env:TASK_ID='easy'
|
| 77 |
+
python -m server.app
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
### Docker (Hugging Face Spaces Ready)
|
| 81 |
+
|
| 82 |
+
```bash
|
| 83 |
+
# Build
|
| 84 |
+
docker build -t sql-sandbox:latest .
|
| 85 |
+
|
| 86 |
+
# Run on HF Spaces default port 7860
|
| 87 |
+
docker run -p 7860:7860 sql-sandbox:latest
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
## Baseline Inference
|
| 91 |
+
|
| 92 |
+
Runs GPT-4o on all three tasks and prints reproducible scores.
|
| 93 |
+
|
| 94 |
+
```powershell
|
| 95 |
+
# For local testing in PowerShell (Windows)
|
| 96 |
+
$env:HF_TOKEN='sk-...'
|
| 97 |
+
$env:MODEL_NAME='gpt-4o'
|
| 98 |
+
python inference.py --url http://localhost:7860
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
## Project Structure
|
| 102 |
+
|
| 103 |
+
```
|
| 104 |
+
.
|
| 105 |
+
βββ Dockerfile # Root Dockerfile for HF Spaces
|
| 106 |
+
βββ openenv.yaml # OpenEnv manifest (port 7860)
|
| 107 |
+
βββ pyproject.toml # Package dependencies
|
| 108 |
+
βββ inference.py # baseline inference script
|
| 109 |
+
βββ inference_groq.py # groq inference script
|
| 110 |
+
βββ README.md # This file
|
| 111 |
+
βββ client.py # EnvClient helper
|
| 112 |
+
βββ models.py # Action & Observation models
|
| 113 |
+
βββ server/
|
| 114 |
+
βββ app.py # FastAPI server entry point
|
| 115 |
+
βββ environment.py # Core environment logic + graders
|
| 116 |
+
```
|