From f925434c1625bb9448d7531cac1b2831377ba386 Mon Sep 17 00:00:00 2001 From: Jules Kuehn <jk@jules.lol> Date: Thu, 7 Mar 2024 17:28:37 -0500 Subject: [PATCH] fix: relative score fusion bug (#11759) --- .../llama_index/core/retrievers/fusion_retriever.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/llama-index-core/llama_index/core/retrievers/fusion_retriever.py b/llama-index-core/llama_index/core/retrievers/fusion_retriever.py index 9ea463644d..45fa1bae89 100644 --- a/llama-index-core/llama_index/core/retrievers/fusion_retriever.py +++ b/llama-index-core/llama_index/core/retrievers/fusion_retriever.py @@ -141,6 +141,9 @@ class QueryFusionRetriever(BaseRetriever): # then scale by the weight of the retriever min_max_scores = {} for query_tuple, nodes_with_scores in results.items(): + if not nodes_with_scores: + min_max_scores[query_tuple] = (0.0, 0.0) + continue scores = [node_with_score.score for node_with_score in nodes_with_scores] if dist_based: # Set min and max based on mean and std dev -- GitLab