Spaces:
Sleeping
Sleeping
Commit ·
6c6f994
1
Parent(s): 55bb0ce
pin openenv-core version to force reinstall
Browse files- requirements.txt +1 -1
- sql_env/server.py +7 -33
requirements.txt
CHANGED
|
@@ -3,4 +3,4 @@ uvicorn==0.30.1
|
|
| 3 |
pydantic==2.7.1
|
| 4 |
httpx==0.27.0
|
| 5 |
openai==1.30.1
|
| 6 |
-
openenv-core
|
|
|
|
| 3 |
pydantic==2.7.1
|
| 4 |
httpx==0.27.0
|
| 5 |
openai==1.30.1
|
| 6 |
+
openenv-core==0.2.3
|
sql_env/server.py
CHANGED
|
@@ -6,10 +6,11 @@ Exposes the OpenEnv-required endpoints: /reset, /step, /state + /tasks for valid
|
|
| 6 |
|
| 7 |
from contextlib import asynccontextmanager
|
| 8 |
from typing import Optional
|
|
|
|
| 9 |
from fastapi import FastAPI, HTTPException
|
| 10 |
from fastapi.middleware.cors import CORSMiddleware
|
| 11 |
from pydantic import BaseModel
|
| 12 |
-
|
| 13 |
from sql_env import SQLAction, SQLCorrectionEnv
|
| 14 |
from sql_env.tasks import ALL_TASKS
|
| 15 |
|
|
@@ -98,39 +99,12 @@ async def health():
|
|
| 98 |
|
| 99 |
@app.get("/tasks")
|
| 100 |
async def list_tasks():
|
| 101 |
-
"""Return graded tasks
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
{
|
| 106 |
-
"name": "easy",
|
| 107 |
-
"difficulty": "easy",
|
| 108 |
-
"description": "Fix a single syntax error. Error hint provided.",
|
| 109 |
-
"max_steps": 5,
|
| 110 |
-
"has_grader": True,
|
| 111 |
-
"grader": "sql_env.grader.grade",
|
| 112 |
-
"grader_fn": grade.__module__ + "." + grade.__qualname__,
|
| 113 |
-
},
|
| 114 |
-
{
|
| 115 |
-
"name": "medium",
|
| 116 |
-
"difficulty": "medium",
|
| 117 |
-
"description": "Fix multiple errors. No hint.",
|
| 118 |
-
"max_steps": 5,
|
| 119 |
-
"has_grader": True,
|
| 120 |
-
"grader": "sql_env.grader.grade",
|
| 121 |
-
"grader_fn": grade.__module__ + "." + grade.__qualname__,
|
| 122 |
-
},
|
| 123 |
-
{
|
| 124 |
-
"name": "hard",
|
| 125 |
-
"difficulty": "hard",
|
| 126 |
-
"description": "Fix complex multi-join queries. Schema provided.",
|
| 127 |
-
"max_steps": 4,
|
| 128 |
-
"has_grader": True,
|
| 129 |
-
"grader": "sql_env.grader.grade",
|
| 130 |
-
"grader_fn": grade.__module__ + "." + grade.__qualname__,
|
| 131 |
-
},
|
| 132 |
-
]
|
| 133 |
}
|
|
|
|
| 134 |
|
| 135 |
|
| 136 |
@app.get("/")
|
|
|
|
| 6 |
|
| 7 |
from contextlib import asynccontextmanager
|
| 8 |
from typing import Optional
|
| 9 |
+
|
| 10 |
from fastapi import FastAPI, HTTPException
|
| 11 |
from fastapi.middleware.cors import CORSMiddleware
|
| 12 |
from pydantic import BaseModel
|
| 13 |
+
|
| 14 |
from sql_env import SQLAction, SQLCorrectionEnv
|
| 15 |
from sql_env.tasks import ALL_TASKS
|
| 16 |
|
|
|
|
| 99 |
|
| 100 |
@app.get("/tasks")
|
| 101 |
async def list_tasks():
|
| 102 |
+
"""Return graded tasks by difficulty (RL validator format)."""
|
| 103 |
+
graded_tasks = {
|
| 104 |
+
diff: [task.__dict__ for task in tasks if task.grader is not None]
|
| 105 |
+
for diff, tasks in ALL_TASKS.items()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
}
|
| 107 |
+
return graded_tasks # {"easy": [tasks], "medium": [tasks], "hard": [tasks]}
|
| 108 |
|
| 109 |
|
| 110 |
@app.get("/")
|