diff --git a/integrations/fastembed/src/haystack_integrations/components/rankers/fastembed/ranker.py b/integrations/fastembed/src/haystack_integrations/components/rankers/fastembed/ranker.py index 69323a4d3..2835e2ca1 100644 --- a/integrations/fastembed/src/haystack_integrations/components/rankers/fastembed/ranker.py +++ b/integrations/fastembed/src/haystack_integrations/components/rankers/fastembed/ranker.py @@ -161,9 +161,8 @@ def run(self, query: str, documents: List[Document], top_k: Optional[int] = None msg = "No query provided" raise ValueError(msg) - if documents.count == 0: - msg = "No documents provided" - raise ValueError(msg) + if not documents: + return {"documents": []} top_k = top_k or self.top_k if top_k <= 0: