srishtichugh commited on
Commit
5ededc8
·
1 Parent(s): dd46663

Fix openenv validate

Browse files
Files changed (2) hide show
  1. pyproject.toml +1 -1
  2. server/app.py +74 -2
pyproject.toml CHANGED
@@ -16,7 +16,7 @@ dependencies = [
16
  ]
17
 
18
  [project.scripts]
19
- serve = "server.app:main"
20
 
21
  [build-system]
22
  requires = ["hatchling"]
 
16
  ]
17
 
18
  [project.scripts]
19
+ server = "server.app:main"
20
 
21
  [build-system]
22
  requires = ["hatchling"]
server/app.py CHANGED
@@ -1,6 +1,7 @@
1
  """
2
  FastAPI application exposing the OpenEnv-compatible HTTP API.
3
- Endpoints: GET /health, POST /reset, POST /step, POST /state, GET /docs
 
4
  """
5
 
6
  from typing import Optional
@@ -38,7 +39,78 @@ class StepResponse(BaseModel):
38
 
39
  @app.get("/health")
40
  def health():
41
- return {"status": "ok"}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
 
44
  @app.post("/reset", response_model=StepResponse)
 
1
  """
2
  FastAPI application exposing the OpenEnv-compatible HTTP API.
3
+ Endpoints: GET /health, GET /metadata, GET /schema,
4
+ POST /reset, POST /step, POST /state, GET /docs
5
  """
6
 
7
  from typing import Optional
 
39
 
40
  @app.get("/health")
41
  def health():
42
+ return {"status": "healthy"}
43
+
44
+
45
+ @app.get("/metadata")
46
+ def metadata():
47
+ return {
48
+ "name": "data-cleaning-env",
49
+ "description": (
50
+ "A real-world data cleaning environment where an AI agent fixes "
51
+ "missing values, duplicate rows, format inconsistencies, outliers, "
52
+ "and dtype errors across three progressively harder tasks."
53
+ ),
54
+ "version": "0.1.0",
55
+ "tags": ["openenv", "data-cleaning", "rl", "real-world"],
56
+ "tasks": [
57
+ {"id": "task1", "name": "Fill Missing Values", "difficulty": "easy"},
58
+ {"id": "task2", "name": "Fix Formats and Remove Duplicates", "difficulty": "medium"},
59
+ {"id": "task3", "name": "Full Cleaning Pipeline", "difficulty": "hard"},
60
+ ],
61
+ }
62
+
63
+
64
+ @app.get("/schema")
65
+ def schema():
66
+ return {
67
+ "action": {
68
+ "type": "object",
69
+ "properties": {
70
+ "operation": {
71
+ "type": "string",
72
+ "enum": [
73
+ "fill_missing",
74
+ "drop_duplicates",
75
+ "fix_format",
76
+ "replace_value",
77
+ "drop_outliers",
78
+ "fix_dtype",
79
+ ],
80
+ },
81
+ "column": {"type": "string", "nullable": True},
82
+ "params": {"type": "object", "nullable": True},
83
+ },
84
+ "required": ["operation"],
85
+ },
86
+ "observation": {
87
+ "type": "object",
88
+ "properties": {
89
+ "done": {"type": "boolean"},
90
+ "reward": {"type": "number"},
91
+ "data_preview": {"type": "string"},
92
+ "data_shape": {"type": "array", "items": {"type": "integer"}},
93
+ "missing_counts": {"type": "object"},
94
+ "duplicate_count": {"type": "integer"},
95
+ "dtype_issues": {"type": "object"},
96
+ "task_description": {"type": "string"},
97
+ "message": {"type": "string"},
98
+ "step_count": {"type": "integer"},
99
+ "current_score": {"type": "number"},
100
+ },
101
+ },
102
+ "state": {
103
+ "type": "object",
104
+ "properties": {
105
+ "episode_id": {"type": "string"},
106
+ "task_id": {"type": "integer"},
107
+ "step_count": {"type": "integer"},
108
+ "max_steps": {"type": "integer"},
109
+ "total_errors": {"type": "integer"},
110
+ "errors_remaining": {"type": "integer"},
111
+ },
112
+ },
113
+ }
114
 
115
 
116
  @app.post("/reset", response_model=StepResponse)