update for ragas

This commit is contained in:
wangwei
2026-07-01 17:53:00 +08:00
parent 2bb804b059
commit 4e74e1b247
15 changed files with 507 additions and 53 deletions
+2 -1
View File
@@ -159,7 +159,8 @@ def _select_low_samples(
valid = [r for r in rows if metric in r and not math.isnan(float(r[metric]))]
sorted_rows = sorted(valid, key=lambda r: float(r[metric]), reverse=not higher_is_better)
worst = sorted_rows[:top_n]
keep_keys = {"sample_id", "question", "answer", "ground_truth", metric}
# contexts is included so the LLM/fallback can judge grounding (retrieval vs generation).
keep_keys = {"sample_id", "question", "answer", "ground_truth", "contexts", metric}
return [{k: v for k, v in row.items() if k in keep_keys} for row in worst]