JacobLinCool Codex commited on
Commit
2bc6ea9
·
verified ·
1 Parent(s): e493b7e

fix: accept judged quest label aliases

Browse files

Co-authored-by: Codex <noreply@openai.com>

hackathon_advisor/quest_taxonomy.py CHANGED
@@ -136,6 +136,10 @@ _QUEST_ALIASES: dict[str, str] = {}
136
  for _profile in QUEST_PROFILES:
137
  _QUEST_ALIASES[_quest_key(_profile["id"])] = _profile["id"]
138
  _QUEST_ALIASES[_quest_key(_profile["label"])] = _profile["id"]
 
 
 
 
139
  _QUEST_ALIASES.update(
140
  {
141
  _quest_key("Best MiniCPM Build"): "OpenBMB",
 
136
  for _profile in QUEST_PROFILES:
137
  _QUEST_ALIASES[_quest_key(_profile["id"])] = _profile["id"]
138
  _QUEST_ALIASES[_quest_key(_profile["label"])] = _profile["id"]
139
+ _QUEST_ALIASES[_quest_key(f"Best {_profile['id']}")] = _profile["id"]
140
+ _QUEST_ALIASES[_quest_key(f"Best {_profile['label']}")] = _profile["id"]
141
+ _QUEST_ALIASES[_quest_key(f"Best Use of {_profile['id']}")] = _profile["id"]
142
+ _QUEST_ALIASES[_quest_key(f"Best Use of {_profile['label']}")] = _profile["id"]
143
  _QUEST_ALIASES.update(
144
  {
145
  _quest_key("Best MiniCPM Build"): "OpenBMB",
tests/test_dashboard.py CHANGED
@@ -243,6 +243,52 @@ def test_quest_analysis_validation_expands_known_composite_quest_labels() -> Non
243
  assert quests == ["OpenBMB", "Tiny Titan", "Off-Brand", "Sharing is Caring"]
244
 
245
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
246
  def test_quest_analysis_validation_rejects_unknown_composite_quest_labels() -> None:
247
  projects = fake_projects(1)
248
  raw = {
 
243
  assert quests == ["OpenBMB", "Tiny Titan", "Off-Brand", "Sharing is Caring"]
244
 
245
 
246
+ def test_quest_analysis_validation_accepts_best_prefixed_known_labels() -> None:
247
+ projects = fake_projects(1)
248
+ raw = {
249
+ "projects": [
250
+ {
251
+ "project_id": projects[0].id,
252
+ "matches": [
253
+ {
254
+ "quest": "Best Well-Tuned",
255
+ "confidence": 0.84,
256
+ "evidence": "PEFT adapter",
257
+ "source": "app_file",
258
+ }
259
+ ],
260
+ }
261
+ ]
262
+ }
263
+
264
+ validated = validate_quest_analysis_payload(raw, projects, source="fake")
265
+
266
+ assert validated.matches_by_project[projects[0].id][0]["quest"] == "Well-Tuned"
267
+
268
+
269
+ def test_quest_analysis_validation_accepts_best_use_of_known_labels() -> None:
270
+ projects = fake_projects(1)
271
+ raw = {
272
+ "projects": [
273
+ {
274
+ "project_id": projects[0].id,
275
+ "matches": [
276
+ {
277
+ "quest": "Best Use of Modal",
278
+ "confidence": 0.84,
279
+ "evidence": "modal.App background worker",
280
+ "source": "app_file",
281
+ }
282
+ ],
283
+ }
284
+ ]
285
+ }
286
+
287
+ validated = validate_quest_analysis_payload(raw, projects, source="fake")
288
+
289
+ assert validated.matches_by_project[projects[0].id][0]["quest"] == "Modal"
290
+
291
+
292
  def test_quest_analysis_validation_rejects_unknown_composite_quest_labels() -> None:
293
  projects = fake_projects(1)
294
  raw = {