Skip to content

Commit

Permalink
Cleaner way to handle when documents is empty
Browse files Browse the repository at this point in the history
Co-authored-by: Stefano Fiorucci <[email protected]>
  • Loading branch information
paulmartrencharpro and anakin87 authored Nov 13, 2024
1 parent b68e879 commit 286ae8a
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 286ae8a

Please sign in to comment.