Skip to content

Commit

Permalink
[Evals] If ideal is not list, cast as list (openai#800)
Browse files Browse the repository at this point in the history
Resolves openai#791
  • Loading branch information
andrew-openai committed Apr 24, 2023
1 parent 24dae81 commit 004d681
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions evals/elsuite/basic/fuzzy_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ def __init__(
def eval_sample(self, test_sample, rng):
del rng
prompt, correct_answers = test_sample["input"], test_sample["ideal"]
if not isinstance(correct_answers, list):
correct_answers = [correct_answers]

result = self.completion_fn(
prompt=prompt,
temperature=0.0, # Q: why are these hardcoded?
Expand All @@ -31,6 +34,7 @@ def eval_sample(self, test_sample, rng):
sampled = result.get_completions()[0]

matches = [utils.fuzzy_match(sampled, correct_answer) for correct_answer in correct_answers]

evals.record.record_match(
True in matches,
expected=correct_answers,
Expand Down

0 comments on commit 004d681

Please sign in to comment.