Update utils.py
Browse files
utils.py
CHANGED
@@ -329,15 +329,15 @@ def grade_documents_direct(prompt, documents):
|
|
329 |
|
330 |
# Score
|
331 |
filtered_docs = []
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
|
342 |
return filtered_docs
|
343 |
|
|
|
329 |
|
330 |
# Score
|
331 |
filtered_docs = []
|
332 |
+
for d in documents:
|
333 |
+
score = chain.invoke({"question": question, "context": d.page_content})
|
334 |
+
grade = score[0].binary_score
|
335 |
+
if grade == "ja":
|
336 |
+
print("---Bewertung: Dokument ist relevant---")
|
337 |
+
filtered_docs.append(d)
|
338 |
+
else:
|
339 |
+
print("---Bewertung: Dokument irrelevant---")
|
340 |
+
continue
|
341 |
|
342 |
return filtered_docs
|
343 |
|