Zekun Wu
commited on
Commit
•
bb4bda1
1
Parent(s):
491fd45
update
Browse files- util/evaluator.py +2 -2
util/evaluator.py
CHANGED
@@ -11,7 +11,8 @@ class evaluator:
|
|
11 |
required_keys = ["Factually Correct", "Useful", "Context Specific", "User Specific", "Provides Pluralism"]
|
12 |
for key in required_keys:
|
13 |
if key not in scores or not isinstance(scores[key], (int, float)) or not (0 <= scores[key] <= 1):
|
14 |
-
return
|
|
|
15 |
return scores
|
16 |
|
17 |
def __call__(self, question,explanation):
|
@@ -63,7 +64,6 @@ class evaluator:
|
|
63 |
print(response)
|
64 |
try:
|
65 |
scores = json.loads(response)
|
66 |
-
print(scores)
|
67 |
except json.JSONDecodeError:
|
68 |
# Attempt to repair the JSON if decoding fails
|
69 |
repaired_json = json_repair.repair_json(response, skip_json_loads=True, return_objects=False)
|
|
|
11 |
required_keys = ["Factually Correct", "Useful", "Context Specific", "User Specific", "Provides Pluralism"]
|
12 |
for key in required_keys:
|
13 |
if key not in scores or not isinstance(scores[key], (int, float)) or not (0 <= scores[key] <= 1):
|
14 |
+
return {"Factually Correct": -1,"Useful": -1,"Context Specific": -1,"User Specific":-1,"Provides Pluralism":-1}
|
15 |
+
|
16 |
return scores
|
17 |
|
18 |
def __call__(self, question,explanation):
|
|
|
64 |
print(response)
|
65 |
try:
|
66 |
scores = json.loads(response)
|
|
|
67 |
except json.JSONDecodeError:
|
68 |
# Attempt to repair the JSON if decoding fails
|
69 |
repaired_json = json_repair.repair_json(response, skip_json_loads=True, return_objects=False)
|