Skip to content

Commit 957c550

Browse files
authored
Merge pull request #105 from KaminariOS/fix_is_exact_match
Fix is_exact_match logic
2 parents cbd5da8 + ff5f548 commit 957c550

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

aiopslab/orchestrator/evaluators/quantitative.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,16 @@ def in_tokens(trace: list[SessionItem]) -> int:
3434

3535

3636
def is_exact_match(pred: int | str | list, target: int | str | list) -> bool:
37-
"""Return True if the prediction is an exact match to the target."""
38-
return pred == target
37+
"""Return True if the prediction is an exact match to the target.
38+
Also considers ["x"] and "x" as equivalent.
39+
"""
40+
# Normalize both sides to lists for consistent comparison
41+
def normalize(value: int | str | list) -> list:
42+
if isinstance(value, list):
43+
return value
44+
return [value]
45+
46+
return normalize(pred) == normalize(target)
3947

4048

4149
def is_exact_match_lower(pred: str, target: str) -> bool:

0 commit comments

Comments
 (0)