diff --git a/llama-index-integrations/postprocessor/llama-index-postprocessor-bedrock-rerank/llama_index/postprocessor/bedrock_rerank/base.py b/llama-index-integrations/postprocessor/llama-index-postprocessor-bedrock-rerank/llama_index/postprocessor/bedrock_rerank/base.py index 1606f41f08e46..dbae397554093 100644 --- a/llama-index-integrations/postprocessor/llama-index-postprocessor-bedrock-rerank/llama_index/postprocessor/bedrock_rerank/base.py +++ b/llama-index-integrations/postprocessor/llama-index-postprocessor-bedrock-rerank/llama_index/postprocessor/bedrock_rerank/base.py @@ -208,6 +208,9 @@ def _postprocess_nodes( }, } ) + # change top_n if the number of nodes is less than top_n + if len(nodes) < self.top_n: + self.top_n = len(nodes) queries = [ {