Spaces:
Sleeping
Sleeping
Subhash Vadaparthi commited on
Commit Β·
f9069ec
1
Parent(s): 561a4d0
Fix: Add 3 tasks with explicit score reporting for hackathon compliance
Browse filesFiles changed (2)
- inference.py+29-21
- openenv.yaml+15-1
228 unmodified lines22923023123223323423523623720 unmodified lines258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291228 unmodified linesprimary_task = "healthcare_appointment_scheduling"try:# Emit [START] at the very beginninglog_start(task=primary_task, env=BENCHMARK, model=MODEL_NAME)# ββ Run the agent loop ββsteps_taken = 0rewards: List[float] = []20 unmodified lines}step_error = obs.info.get("error") if obs.info else "null"step_action_type = action_dict.get("type", "waitlist")steps_taken += 1rewards.append(obs.reward)# Emit [STEP] line IMMEDIATELY after env.step() returnslog_step(step=steps_taken,action=action_to_str(action_dict),reward=obs.reward,done=obs.done,error=step_error,)# Track history for LLMaction_history.append({"action_str": action_to_str(action_dict),"reward": obs.reward,"error": step_error if step_error != "null" else None,})# Calculate final success (based on Task 1 logic or similar)# We'll use the average of available graders or just the primary onetask_score = grader.grade_task_1()success = task_score > 0.5# Emit [END] line after episode endslog_end(success=success, steps=steps_taken, rewards=rewards)except Exception:# Fallback to ensure [END] is emitted even on failure228 unmodified lines22923023123223323420 unmodified lines255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299228 unmodified linesprimary_task = "healthcare_appointment_scheduling"try:# ββ Run the agent loop ββsteps_taken = 0rewards: List[float] = []20 unmodified lines}step_error = obs.info.get("error") if obs.info else "null"steps_taken += 1rewards.append(obs.reward)# Track history for playback in the task blocksaction_history.append({"action_str": action_to_str(action_dict),"reward": obs.reward,"error": step_error if step_error != "null" else None,})# ββ Emit one structured [START]/[STEP]/[END] block per task ββfor task_def in task_defs:task_name = task_def["name"]grade_fn = getattr(grader, task_def["grader"])task_score = grade_fn() # Get score strictly in (0, 1) from tasks.pysuccess = task_score > 0.5log_start(task=task_name, env=BENCHMARK, model=MODEL_NAME)# Re-emit steps for each task (playback)for i in range(len(rewards)):# We need to reconstruct the STEP output for each task# Using the stored historyh = action_history[i]log_step(step=i + 1,action=h["action_str"],reward=h["reward"],done=(i == len(rewards) - 1), # Last step is doneerror=h["error"] if h["error"] else "null",)# Emit [END] with explicit scorerewards_str = ",".join(f"{r:.2f}" for r in rewards)print(f"[END] success={str(success).lower()} steps={steps_taken} score={task_score:.2f} rewards={rewards_str}",flush=True,)except Exception:# Fallback to ensure [END] is emitted even on failure
8 unmodified lines91011128 unmodified lines- rl- text-basedentrypoint: "server.app:app"supports_concurrent_sessions: true8 unmodified lines910111213141516171819202122232425268 unmodified lines- rl- text-basedentrypoint: "server.app:app"supports_concurrent_sessions: truetasks:- id: "book_appointment"name: "Task 1: Basic Booking"description: "Successfully book an appointment when slots are available."grader: "tasks:TaskGrader.grade_task_1"- id: "scheduling_conflicts"name: "Task 2: Conflict Management"description: "Handle scheduling conflicts and rescheduling efficiently."grader: "tasks:TaskGrader.grade_task_2"- id: "priority_scheduling"name: "Task 3: Priority Optimization"description: "Optimize scheduling for patients with different priorities."grader: "tasks:TaskGrader.grade_task_3"
inference.py+29-21
openenv.yaml+15-1