From 9d717f0b6e5ace8c82420009a1ed453e69dbf7e8 Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Fri, 24 Jan 2025 14:47:19 +0800 Subject: [PATCH] Fix csv reader exception. (#4628) ### What problem does this PR solve? #4552 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- rag/app/qa.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rag/app/qa.py b/rag/app/qa.py index 0ad2dc9f..ebc3677a 100644 --- a/rag/app/qa.py +++ b/rag/app/qa.py @@ -394,7 +394,7 @@ def chunk(filename, binary=None, lang="Chinese", callback=None, **kwargs): f"{len(fails)} failure, line: %s..." % (",".join(fails[:3])) if fails else ""))) if question: - res.append(beAdoc(deepcopy(doc), question, answer, eng, len(reader))) + res.append(beAdoc(deepcopy(doc), question, answer, eng, len(list(reader)))) callback(0.6, ("Extract Q&A: {}".format(len(res)) + ( f"{len(fails)} failure, line: %s..." % (",".join(fails[:3])) if fails else "")))