瀏覽代碼

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

tags/0.7.2
张皮皮 1 年之前
父節點
當前提交
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 []

Loading…
取消
儲存