SujanMidatani commited on
Commit
3b2a89c
·
verified ·
1 Parent(s): a6eb387

Upload folder using huggingface_hub

Browse files
Files changed (5) hide show
  1. inference.py +0 -1
  2. openenv.yaml +1 -1
  3. server/app.py +0 -55
  4. server/env.py +0 -2
  5. server/logic.py +1 -4
inference.py CHANGED
@@ -3,7 +3,6 @@ from __future__ import annotations
3
  import json
4
  import os
5
  import sys
6
- from typing import Any, Dict
7
  from typing import Any, Dict, List, Optional
8
  import requests
9
  from openai import OpenAI
 
3
  import json
4
  import os
5
  import sys
 
6
  from typing import Any, Dict, List, Optional
7
  import requests
8
  from openai import OpenAI
openenv.yaml CHANGED
@@ -85,4 +85,4 @@ server:
85
  state_full: GET /state_full
86
  episode_summary: GET /episode_summary
87
  schema: GET /schema
88
- docs: GET /docs
 
85
  state_full: GET /state_full
86
  episode_summary: GET /episode_summary
87
  schema: GET /schema
88
+ docs: GET /docs
server/app.py CHANGED
@@ -119,61 +119,6 @@ async def episode_summary() -> JSONResponse:
119
  "reviewer_note": state.reviewer_note,
120
  })
121
 
122
- @app.post("/grader")
123
- async def grader():
124
- state = _env.state
125
- breakdown = dict(state.reward_breakdown or {})
126
- score = float(sum(breakdown.values()))
127
- score = max(0.0, min(1.0, score))
128
-
129
- return {
130
- "task_id": state.current_case_id,
131
- "score": score,
132
- "reward": score,
133
- "passed": bool(state.done and score >= 0.5),
134
- "done": state.done,
135
- "final_action": state.final_action,
136
- "reviewer_note": state.reviewer_note,
137
- "reward_breakdown": breakdown,
138
- }
139
-
140
-
141
- @app.get("/tasks")
142
- async def list_tasks():
143
- return {
144
- "tasks": [
145
- {
146
- "id": "violence-remove",
147
- "name": "violence-remove",
148
- "description": "Agent must identify violent content and issue a remove action.",
149
- "difficulty": "hard",
150
- },
151
- {
152
- "id": "nudity-flag",
153
- "name": "nudity-flag",
154
- "description": "Agent must identify nudity/sexual content and issue a flag action.",
155
- "difficulty": "medium",
156
- },
157
- {
158
- "id": "harassment-flag",
159
- "name": "harassment-flag",
160
- "description": "Agent must identify harassment and issue a flag action.",
161
- "difficulty": "medium",
162
- },
163
- {
164
- "id": "misinfo-escalate",
165
- "name": "misinfo-escalate",
166
- "description": "Agent must identify misinformation and escalate for review.",
167
- "difficulty": "hard",
168
- },
169
- {
170
- "id": "benign-allow",
171
- "name": "benign-allow",
172
- "description": "Agent must correctly allow benign/safe content.",
173
- "difficulty": "easy",
174
- },
175
- ]
176
- }
177
 
178
  # ---------------------------------------------------------------------------
179
  # Helper endpoints
 
119
  "reviewer_note": state.reviewer_note,
120
  })
121
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
 
123
  # ---------------------------------------------------------------------------
124
  # Helper endpoints
server/env.py CHANGED
@@ -12,7 +12,6 @@ try:
12
  get_case,
13
  get_expected_action,
14
  compute_step_reward,
15
- load_tasks
16
  )
17
  from .rag.retriever import retrieve_policy_chunks
18
  except ImportError:
@@ -38,7 +37,6 @@ class ModerationEnvironment(Environment):
38
  self._state = State()
39
  self._case: Optional[Dict[str, Any]] = None
40
  self._current_step_index: int = 0
41
- self.tasks = load_tasks()
42
 
43
  # ------------------------------------------------------------------
44
  # OpenEnv interface
 
12
  get_case,
13
  get_expected_action,
14
  compute_step_reward,
 
15
  )
16
  from .rag.retriever import retrieve_policy_chunks
17
  except ImportError:
 
37
  self._state = State()
38
  self._case: Optional[Dict[str, Any]] = None
39
  self._current_step_index: int = 0
 
40
 
41
  # ------------------------------------------------------------------
42
  # OpenEnv interface
server/logic.py CHANGED
@@ -114,7 +114,4 @@ def compute_step_reward(
114
  return REWARD_REVIEWER_AGREEMENT
115
  return 0.0
116
  # finalize — no additional reward
117
- return 0.0
118
-
119
- def load_tasks():
120
- return list(MODERATION_CASES.values())
 
114
  return REWARD_REVIEWER_AGREEMENT
115
  return 0.0
116
  # finalize — no additional reward
117
+ return 0.0