@@ -63,6 +63,7 @@ def step(self, action: Action | Dict[str, Any]) -> Tuple[Observation, float, boo
6363
6464 current_email = self .dataset [self .index ]
6565 reward_obj = compute_step_reward (action = action , truth = current_email , task = self .task )
66+ reward = SAFE_SCORE (reward_obj .total )
6667 self .grader .update (action = action , truth = current_email )
6768
6869 # Update tracking statistics
@@ -77,8 +78,8 @@ def step(self, action: Action | Dict[str, Any]) -> Tuple[Observation, float, boo
7778 if action .priority and action .priority .value == "urgent" :
7879 self .urgent_handled += 1
7980
80- self .last_reward = reward_obj . total
81- self .cumulative_reward += reward_obj . total
81+ self .last_reward = reward
82+ self .cumulative_reward += reward
8283
8384 self .index += 1
8485 self .done = self .index >= len (self .dataset )
@@ -106,7 +107,7 @@ def step(self, action: Action | Dict[str, Any]) -> Tuple[Observation, float, boo
106107 "urgent_handled" : self .urgent_handled ,
107108 },
108109 }
109- return next_observation , reward_obj . total , self .done , info
110+ return next_observation , reward , self .done , info
110111
111112 def final_score (self ) -> float :
112113 return SAFE_SCORE (self .grader .score ())
@@ -142,7 +143,7 @@ def step(self, action: Dict[str, Any]) -> Tuple[Dict[str, Any], float, bool, Dic
142143 predicted_action = str (action .get ("action" , "" )).strip ()
143144 expected_action = self ._expected_action_for_email (current_email )
144145 correct = predicted_action == expected_action
145- reward = 1.0 if correct else - 1.0
146+ reward = SAFE_SCORE ( 1.0 if correct else - 1.0 )
146147
147148 self .current_index += 1
148149 self .done = self .current_index >= len (self .emails )
0 commit comments