Correct AzureSearch Vector Store not applying search_kwargs when searching (#6132)

Fixes #6131 

Simply passes kwargs forward from similarity_search to helper functions
so that search_kwargs are applied to search as originally intended. See
bug for repro steps.

#### Who can review?
  @hwchase17
  @dev2049 

Twitter: poshporcupine
This commit is contained in:
Cameron Vetter 2023-06-18 19:39:06 -05:00 committed by GitHub
parent 395a2a3724
commit 2286204354
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -243,11 +243,11 @@ class AzureSearch(VectorStore):
) -> List[Document]: ) -> List[Document]:
search_type = kwargs.get("search_type", self.search_type) search_type = kwargs.get("search_type", self.search_type)
if search_type == "similarity": if search_type == "similarity":
docs = self.vector_search(query, k=k) docs = self.vector_search(query, k=k, **kwargs)
elif search_type == "hybrid": elif search_type == "hybrid":
docs = self.hybrid_search(query, k=k) docs = self.hybrid_search(query, k=k, **kwargs)
elif search_type == "semantic_hybrid": elif search_type == "semantic_hybrid":
docs = self.semantic_hybrid_search(query, k=k) docs = self.semantic_hybrid_search(query, k=k, **kwargs)
else: else:
raise ValueError(f"search_type of {search_type} not allowed.") raise ValueError(f"search_type of {search_type} not allowed.")
return docs return docs