Skip to content

Commit

Permalink
fix score_threshold is none, return all top K documents (langgenius#7581
Browse files Browse the repository at this point in the history
)
  • Loading branch information
gongchangwangpi authored and cuiks committed Sep 2, 2024
1 parent 5e63d51 commit be0ec36
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion api/core/rag/retrieval/dataset_retrieval.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ def calculate_vector_score(self, all_documents: list[Document],
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 []
Expand Down

0 comments on commit be0ec36

Please sign in to comment.