sravaniamere commited on
Commit
66cc86e
·
1 Parent(s): bb74cb1

fix step format, add tasks endpoint back

Browse files
Files changed (2) hide show
  1. inference.py +1 -3
  2. sql_env/server.py +14 -1
inference.py CHANGED
@@ -216,9 +216,7 @@ async def run_task(task_name: str) -> None:
216
 
217
  # Submit action to environment
218
  try:
219
- step_resp = await http.post(
220
- "/step", json={"corrected_query": action_str}
221
- )
222
  step_resp.raise_for_status()
223
  result = step_resp.json()
224
  except Exception as exc:
 
216
 
217
  # Submit action to environment
218
  try:
219
+ step_resp = await http.post("/step", json={"action":{"corrected_query": action_str}})
 
 
220
  step_resp.raise_for_status()
221
  result = step_resp.json()
222
  except Exception as exc:
sql_env/server.py CHANGED
@@ -105,4 +105,17 @@ def main():
105
 
106
 
107
  if __name__ == "__main__":
108
- main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
 
106
 
107
  if __name__ == "__main__":
108
+ main()
109
+ from fastapi import Request
110
+
111
+ @app.get("/tasks")
112
+ async def list_tasks():
113
+ """Return graded tasks in openenv validator format."""
114
+ from sql_env.grader import grade
115
+ return {
116
+ "tasks": [
117
+ {"id": "easy", "difficulty": "easy", "description": "Fix a single syntax error.", "steps": 5, "ideal_action": "correct_sql", "has_grader": True},
118
+ {"id": "medium", "difficulty": "medium", "description": "Fix multiple errors.", "steps": 5, "ideal_action": "correct_sql", "has_grader": True},
119
+ {"id": "hard", "difficulty": "hard", "description": "Fix complex multi-join queries.", "steps": 4, "ideal_action": "correct_sql", "has_grader": True},
120
+ ]
121
+ }