in src/fmeval/eval_algorithms/__init__.py [0:0]
def __eq__(self, other: Type["EvalOutput"]): # type: ignore[override]
try:
assert self.eval_name == other.eval_name
assert self.dataset_name == other.dataset_name
assert self.prompt_template == other.prompt_template
assert self.error == other.error
assert self.dataset_scores if other.dataset_scores else not self.dataset_scores
if self.dataset_scores: # pragma: no branch
assert self.dataset_scores and other.dataset_scores
assert len(self.dataset_scores) == len(other.dataset_scores)
assert seq(self.dataset_scores).sorted(key=lambda x: x.name).zip(
seq(other.dataset_scores).sorted(key=lambda x: x.name)
).filter(lambda x: x[0] == x[1]).len() == len(self.dataset_scores)
assert self.category_scores if other.category_scores else not self.category_scores
if self.category_scores:
assert seq(self.category_scores).sorted(key=lambda cat_score: cat_score.name).zip(
seq(other.category_scores).sorted(key=lambda cat_score: cat_score.name)
).filter(lambda item: item[0] == item[1]).len() == len(self.category_scores)
return True
except AssertionError:
return False