Skip to content

Commit

Permalink
Fix list contains DX
Browse files Browse the repository at this point in the history
  • Loading branch information
ankrgyl committed Jun 19, 2024
1 parent 4e5869e commit 18c5424
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion py/autoevals/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,19 @@ def __init__(self, pairwise_scorer=None, allow_extra_entities=False, **kwargs):
self.allow_extra_entities = allow_extra_entities
self.pairwise_scorer = pairwise_scorer or Levenshtein()

# If it's a class, then instantiate it
if isinstance(self.pairwise_scorer, type):
self.pairwise_scorer = self.pairwise_scorer()

async def _run_eval_async(self, output, expected=None, **kwargs):
if expected is None:
raise ValueError("ListContains requires an expected value")

similarities_futures = [
[self.pairwise_scorer._run_eval_async(output_item, expected_item) for expected_item in expected]
[
self.pairwise_scorer._run_eval_async(output=output_item, expected=expected_item)
for expected_item in expected
]
for output_item in output
]

Expand Down

0 comments on commit 18c5424

Please sign in to comment.