Spaces:
Sleeping
Sleeping
File size: 1,062 Bytes
d416acc c3bac85 95ca40b 0417917 95ca40b 0417917 95ca40b c3bac85 0417917 95ca40b 0417917 95ca40b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | """Grader for missing_fields task: 400 Bad Request - missing email field."""
def grade() -> float:
"""Grade the missing_fields task. Returns float strictly between 0 and 1."""
try:
import sys
from pathlib import Path
_root = str(Path(__file__).resolve().parent.parent.parent)
if _root not in sys.path:
sys.path.insert(0, _root)
from environment.api_triage_env import APITriageEnv
from environment.incident_generator import get_incident_by_type
env = APITriageEnv(max_steps=10)
env.incident = get_incident_by_type("missing_fields")
if env.incident is None:
return 0.1
env.fix_applied = False
env.done = False
env.step_counter = 0
env.total_reward = 0.0
for action in ["inspect_logs", "add_field", "resolve"]:
_, _, done, info = env.step(action)
if done:
return 0.95 if info.get("resolution") == "success" else 0.1
return 0.1
except Exception:
return 0.1
|