in src/fmeval/transforms/summarization_accuracy_metrics.py [0:0]
def __call__(self, record: Dict[str, Any]) -> Dict[str, Any]:
"""Augment the input record with metrics computed via self.compute_metric.
The max score is computed over all possible targets represented by
self.target_output_keys and stored in the input record.
:param record: The input record.
:returns: The input record with metrics added in.
"""
target_output_list = (
[record[target_output_key] for target_output_key in self.target_output_keys]
if self.target_output_keys
else record[self.target_output_keys_provider] # type: ignore[index]
)
for model_output_key, output_key in zip(self.model_output_keys, self.output_keys):
scores = [self.compute_metric(target, record[model_output_key]) for target in target_output_list]
record[output_key] = max(scores)
return record