Spaces:
Sleeping
Sleeping
Commit ·
b213994
1
Parent(s): 3ec25ed
debugged the task validation error
Browse files- app/__pycache__/models.cpython-313.pyc +0 -0
- app/models.py +6 -3
- validate_submission.py +11 -0
app/__pycache__/models.cpython-313.pyc
CHANGED
|
Binary files a/app/__pycache__/models.cpython-313.pyc and b/app/__pycache__/models.cpython-313.pyc differ
|
|
|
app/models.py
CHANGED
|
@@ -23,7 +23,10 @@ class Action(BaseModel):
|
|
| 23 |
|
| 24 |
|
| 25 |
class Reward(BaseModel):
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
| 27 |
matched_criteria: list[str]
|
| 28 |
missed_criteria: list[str]
|
| 29 |
penalties: dict[str, float]
|
|
@@ -43,7 +46,7 @@ class EnvState(BaseModel):
|
|
| 43 |
current_task_type: TaskType | None
|
| 44 |
status: str
|
| 45 |
total_steps: int
|
| 46 |
-
last_reward: float | None
|
| 47 |
history: list[dict[str, Any]]
|
| 48 |
|
| 49 |
|
|
@@ -75,7 +78,7 @@ class TaskDefinition(BaseModel):
|
|
| 75 |
|
| 76 |
|
| 77 |
class GradeResult(BaseModel):
|
| 78 |
-
score: float = Field(
|
| 79 |
matched_criteria: list[str]
|
| 80 |
missed_criteria: list[str]
|
| 81 |
penalties: dict[str, float]
|
|
|
|
| 23 |
|
| 24 |
|
| 25 |
class Reward(BaseModel):
|
| 26 |
+
# Align with grader clamp [0.01, 0.99]. Using ge/le makes OpenAPI emit
|
| 27 |
+
# minimum/maximum 0.01/0.99 — not exclusiveMinimum 0.0 / exclusiveMaximum 1.0,
|
| 28 |
+
# which some hub validators misread as forbidden score literals.
|
| 29 |
+
score: float = Field(ge=0.01, le=0.99)
|
| 30 |
matched_criteria: list[str]
|
| 31 |
missed_criteria: list[str]
|
| 32 |
penalties: dict[str, float]
|
|
|
|
| 46 |
current_task_type: TaskType | None
|
| 47 |
status: str
|
| 48 |
total_steps: int
|
| 49 |
+
last_reward: float | None = Field(default=None, ge=0.01, le=0.99)
|
| 50 |
history: list[dict[str, Any]]
|
| 51 |
|
| 52 |
|
|
|
|
| 78 |
|
| 79 |
|
| 80 |
class GradeResult(BaseModel):
|
| 81 |
+
score: float = Field(ge=0.01, le=0.99)
|
| 82 |
matched_criteria: list[str]
|
| 83 |
missed_criteria: list[str]
|
| 84 |
penalties: dict[str, float]
|
validate_submission.py
CHANGED
|
@@ -57,6 +57,16 @@ def _check_openenv_yaml(path: Path) -> None:
|
|
| 57 |
)
|
| 58 |
|
| 59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
def _check_metadata_graders() -> None:
|
| 61 |
client = TestClient(app)
|
| 62 |
response = client.get("/metadata")
|
|
@@ -219,6 +229,7 @@ def main() -> None:
|
|
| 219 |
root = Path(__file__).resolve().parent
|
| 220 |
|
| 221 |
_check_openenv_yaml(root / "openenv.yaml")
|
|
|
|
| 222 |
_check_metadata_graders()
|
| 223 |
_check_tasks_endpoint()
|
| 224 |
_check_api_contracts()
|
|
|
|
| 57 |
)
|
| 58 |
|
| 59 |
|
| 60 |
+
def _check_openapi_reward_schema() -> None:
|
| 61 |
+
"""Synapse-style checks may scan OpenAPI for 0.0/1.0 on score bounds (see Reward model)."""
|
| 62 |
+
client = TestClient(app)
|
| 63 |
+
r = client.get("/openapi.json")
|
| 64 |
+
assert r.status_code == 200
|
| 65 |
+
data = r.json()
|
| 66 |
+
reward = data["components"]["schemas"]["Reward"]["properties"]["score"]
|
| 67 |
+
assert reward.get("minimum") == 0.01 and reward.get("maximum") == 0.99
|
| 68 |
+
|
| 69 |
+
|
| 70 |
def _check_metadata_graders() -> None:
|
| 71 |
client = TestClient(app)
|
| 72 |
response = client.get("/metadata")
|
|
|
|
| 229 |
root = Path(__file__).resolve().parent
|
| 230 |
|
| 231 |
_check_openenv_yaml(root / "openenv.yaml")
|
| 232 |
+
_check_openapi_reward_schema()
|
| 233 |
_check_metadata_graders()
|
| 234 |
_check_tasks_endpoint()
|
| 235 |
_check_api_contracts()
|