vinith17 commited on
Commit
06bcb61
·
1 Parent(s): 362b7f2

Fix score_action to return values strictly between 0 and 1 (exclusive)

Browse files
Files changed (1) hide show
  1. inference.py +4 -2
inference.py CHANGED
@@ -118,7 +118,7 @@ def call_llm(code: str, difficulty: str) -> dict:
118
  def score_action(action: dict, truth: dict) -> float:
119
  """
120
  Score the agent's action against ground truth.
121
- Returns a float in [0.0, 1.0].
122
  """
123
  reward = 0.0
124
 
@@ -137,7 +137,9 @@ def score_action(action: dict, truth: dict) -> float:
137
  if action.get("line_hint") is not None and truth["category"] != "approve":
138
  reward += 0.2
139
 
140
- return round(min(reward, 1.0), 4)
 
 
141
 
142
 
143
  def run_inference():
 
118
  def score_action(action: dict, truth: dict) -> float:
119
  """
120
  Score the agent's action against ground truth.
121
+ Returns a float strictly between 0.0 and 1.0 (exclusive).
122
  """
123
  reward = 0.0
124
 
 
137
  if action.get("line_hint") is not None and truth["category"] != "approve":
138
  reward += 0.2
139
 
140
+ # Clamp to (0.0, 1.0) exclusive: 0.0 → 0.01, 1.0 → 0.99, others scale proportionally
141
+ clamped = 0.01 + (min(reward, 1.0) * 0.98)
142
+ return round(clamped, 4)
143
 
144
 
145
  def run_inference():