← Lesson
When RAG Fails
Joeven
Run
Reset
Python loads on first run
def diagnose(row): if row.get("has_id") and not row.get("called_tool"): return "use_tool_not_rag" if not row.get("in_index"): return "ingest" if row.get("gold_split_across_chunks"): return "chunking" if row.get("recall_at_k") == 0: return "retrieve" if row.get("packed_out"): return "pack" if not row.get("quote_ok"): return "citation" if row.get("poisoned"): return "writeback" return "ok" cases = [ {"has_id": True, "called_tool": False}, {"has_id": False, "in_index": False}, {"has_id": False, "in_index": True, "recall_at_k": 0}, {"has_id": False, "in_index": True, "recall_at_k": 1, "quote_ok": False}, {"has_id": False, "in_index": True, "recall_at_k": 1, "quote_ok": True}, ] for c in cases: print(c, "->", diagnose(c))
Run to execute this in your browser. Nothing is sent to a server.