Skip to content

Commit

Permalink
fix: When all candidate scores are low, there is a bug with no candid…
Browse files Browse the repository at this point in the history
…ates.
  • Loading branch information
xixihahaliu committed May 14, 2024
1 parent 312b844 commit 961fe9e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion qanything_kernel/core/local_doc_qa.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ async def local_doc_search(self, query, kb_ids, score_threshold=0.35):
retrieval_documents = self.rerank_documents(query, retrieval_documents)
# 删除掉分数低于阈值的文档
if score_threshold:
retrieval_documents = [item for item in retrieval_documents if float(item.metadata['score']) > score_threshold]
tmp_documents = [item for item in retrieval_documents if float(item.metadata['score']) > score_threshold]
if tmp_documents:
retrieval_documents = tmp_documents

retrieval_documents = retrieval_documents[: self.rerank_top_k]
debug_logger.info(f"local doc search retrieval_documents: {retrieval_documents}")
Expand Down

0 comments on commit 961fe9e

Please sign in to comment.