소스 검색

fix score_threshold is none, return all top K documents (#7581)

张皮皮 8 달 전
부모
커밋
f29685f8a1
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      api/core/rag/retrieval/dataset_retrieval.py

+ 1 - 1
api/core/rag/retrieval/dataset_retrieval.py

@@ -614,7 +614,7 @@ class DatasetRetrieval:
                                top_k: int, score_threshold: float) -> list[Document]:
         filter_documents = []
         for document in all_documents:
-            if score_threshold and document.metadata['score'] >= score_threshold:
+            if score_threshold is None or document.metadata['score'] >= score_threshold:
                 filter_documents.append(document)
         if not filter_documents:
             return []