sravaniamere commited on
Commit
2112542
Β·
1 Parent(s): 42d2377

add grader endpoint, fix reward bounds and openenv.yaml

Browse files
Files changed (2) hide show
  1. openenv.yaml +5 -2
  2. sql_env/grader.py +2 -2
openenv.yaml CHANGED
@@ -1,3 +1,4 @@
 
1
  name: sql-correction-env
2
  version: "1.0.0"
3
  description: >
@@ -48,7 +49,7 @@ action_space:
48
  description: The agent's corrected SQL query
49
 
50
  reward:
51
- range: [0.0, 1.0]
52
  description: >
53
  1.0 = exact match, 0.7 = right tokens minor structure diff,
54
  0.4 = most keywords correct, 0.2 = basic structure present, 0.0 = invalid SQL.
@@ -76,5 +77,7 @@ tasks:
76
  endpoints:
77
  reset: POST /reset
78
  step: POST /step
79
- state: GET /state
 
 
80
  health: GET /health
 
1
+ spec_version: 1
2
  name: sql-correction-env
3
  version: "1.0.0"
4
  description: >
 
49
  description: The agent's corrected SQL query
50
 
51
  reward:
52
+ range: [0.001, 0.999]
53
  description: >
54
  1.0 = exact match, 0.7 = right tokens minor structure diff,
55
  0.4 = most keywords correct, 0.2 = basic structure present, 0.0 = invalid SQL.
 
77
  endpoints:
78
  reset: POST /reset
79
  step: POST /step
80
+ state: POST /state
81
+ tasks: GET /tasks
82
+ grader: POST /grader
83
  health: GET /health
sql_env/grader.py CHANGED
@@ -53,7 +53,7 @@ def grade(action: SQLAction, task: SQLTask) -> SQLReward:
53
  # ── Level 1: Exact match ─────────────────────────────────
54
  if agent == correct:
55
  return SQLReward(
56
- value=_clamp(0.99),
57
  reason="Exact match β€” perfect correction."
58
  )
59
 
@@ -93,7 +93,7 @@ def grade(action: SQLAction, task: SQLTask) -> SQLReward:
93
  )
94
 
95
  # ── Level 0: No recognizable SQL ─────────────────────────
96
- return SQLReward(value=_clamp(0.01), reason="Response is not valid SQL.")
97
 
98
 
99
  def generate_feedback(action: SQLAction, task: SQLTask, reward: SQLReward) -> str:
 
53
  # ── Level 1: Exact match ─────────────────────────────────
54
  if agent == correct:
55
  return SQLReward(
56
+ value=_clamp(0.999),
57
  reason="Exact match β€” perfect correction."
58
  )
59
 
 
93
  )
94
 
95
  # ── Level 0: No recognizable SQL ─────────────────────────
96
+ return SQLReward(value=_clamp(0.001), reason="Response is not valid SQL.")
97
 
98
 
99
  def generate_feedback(action: SQLAction, task: SQLTask, reward: SQLReward) -> str: