Skip to content

Commit

Permalink
handle top_k correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
masci committed Jan 18, 2024
1 parent b220fef commit a0262c0
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def run(
:raises ValueError: If the specified document store is not found or is not a MemoryDocumentStore instance.
"""
if not top_k:
top_k = 3
top_k = top_k or self.top_k

return {"documents": self.document_store.search([query], top_k)[0]}

def to_dict(self) -> Dict[str, Any]:
Expand Down Expand Up @@ -77,8 +77,7 @@ def run(
:raises ValueError: If the specified document store is not found or is not a MemoryDocumentStore instance.
"""
if not top_k:
top_k = 3
top_k = top_k or self.top_k

query_embeddings = [query_embedding]
return {"documents": self.document_store.search_embeddings(query_embeddings, top_k)[0]}

0 comments on commit a0262c0

Please sign in to comment.