in skills/summarization/evaluation/custom_evals/rouge_eval.py [0:0]
def get_assert(output: str, context, threshold=0.3) -> Union[bool, float, Dict[str, Any]]:
ground_truth = context['vars']['ground_truth']
score = rouge_eval(output, ground_truth)
if score >= threshold:
return {
"pass": True,
"score": score,
"reason": "Average score is above threshold"
}
else:
return {
"pass": False,
"score": score,
"reason": "Average score is below threshold"
}