[ERROR] Prompt xxx failed to parse output:The output parser failed to parse the output including retries. #2022
Labels
bug
Something isn't working
module-metrics
this is part of metrics module
question
Further information is requested
[ ] I have checked the documentation and related resources and couldn't resolve my bug.
Describe the bug
I have the same problem. When the length of reference and response is very long (response 665 characters, reference 2745 characters), llm_context_precision_with_reference,context_recall and fectual_correctness are all nan, and then the error message is: [ERROR] Prompt xxx failed to parse output: The output parser failed to parse the output including retries.
Ragas version:
Python version:3.11.0
Code to Reproduce
def count_score(self, result) -> dict:
scores = asdict(result).get("scores", [])
print(f'result==分数计算算==>{result}')
if not scores:
return {} # 如果 "scores" 列表为空,直接返回空字典
score = {}
for case in scores:
for metrics, value in case.items():
if math.isnan(value):
value = 0 # 将 nan 替换为 0
if metrics not in score:
score[metrics] = value
else:
score[metrics] += value
mean_score = {metrics: round(value / len(scores),2) for metrics, value in score.items()}
return mean_score
Error trace
[ERROR] Prompt xxx failed to parse output:The output parser failed to parse the output including retries.
Expected behavior
I hope these three values llm_context_precision_with_reference,context_recall and fectual_correctness can be calculated
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: