in skills/summarization/evaluation/custom_evals/llm_eval.py [0:0]
def get_assert(output: str, context, threshold=0.5) -> Union[bool, float, Dict[str, Any]]:
input = context['vars']['input']
score, evaluation = llm_eval(output, input)
# 4 different dimensions we measure performance on
normalized_score = score / 4
if normalized_score >= threshold:
return {
"pass": True,
"score": score,
"reason": evaluation
}
else:
return {
"pass": False,
"score": score,
"reason": evaluation
}