|
|
|
@ -280,7 +280,9 @@ class VectorStore(ABC):
|
|
|
|
|
# This is a temporary workaround to make the similarity search
|
|
|
|
|
# asynchronous. The proper solution is to make the similarity search
|
|
|
|
|
# asynchronous in the vector store implementations.
|
|
|
|
|
func = partial(self.similarity_search_with_relevance_scores, query, k, **kwargs)
|
|
|
|
|
func = partial(
|
|
|
|
|
self.similarity_search_with_relevance_scores, query, k=k, **kwargs
|
|
|
|
|
)
|
|
|
|
|
return await asyncio.get_event_loop().run_in_executor(None, func)
|
|
|
|
|
|
|
|
|
|
async def asimilarity_search(
|
|
|
|
@ -291,7 +293,7 @@ class VectorStore(ABC):
|
|
|
|
|
# This is a temporary workaround to make the similarity search
|
|
|
|
|
# asynchronous. The proper solution is to make the similarity search
|
|
|
|
|
# asynchronous in the vector store implementations.
|
|
|
|
|
func = partial(self.similarity_search, query, k, **kwargs)
|
|
|
|
|
func = partial(self.similarity_search, query, k=k, **kwargs)
|
|
|
|
|
return await asyncio.get_event_loop().run_in_executor(None, func)
|
|
|
|
|
|
|
|
|
|
def similarity_search_by_vector(
|
|
|
|
@ -316,7 +318,7 @@ class VectorStore(ABC):
|
|
|
|
|
# This is a temporary workaround to make the similarity search
|
|
|
|
|
# asynchronous. The proper solution is to make the similarity search
|
|
|
|
|
# asynchronous in the vector store implementations.
|
|
|
|
|
func = partial(self.similarity_search_by_vector, embedding, k, **kwargs)
|
|
|
|
|
func = partial(self.similarity_search_by_vector, embedding, k=k, **kwargs)
|
|
|
|
|
return await asyncio.get_event_loop().run_in_executor(None, func)
|
|
|
|
|
|
|
|
|
|
def max_marginal_relevance_search(
|
|
|
|
@ -359,7 +361,12 @@ class VectorStore(ABC):
|
|
|
|
|
# asynchronous. The proper solution is to make the similarity search
|
|
|
|
|
# asynchronous in the vector store implementations.
|
|
|
|
|
func = partial(
|
|
|
|
|
self.max_marginal_relevance_search, query, k, fetch_k, lambda_mult, **kwargs
|
|
|
|
|
self.max_marginal_relevance_search,
|
|
|
|
|
query,
|
|
|
|
|
k=k,
|
|
|
|
|
fetch_k=fetch_k,
|
|
|
|
|
lambda_mult=lambda_mult,
|
|
|
|
|
**kwargs,
|
|
|
|
|
)
|
|
|
|
|
return await asyncio.get_event_loop().run_in_executor(None, func)
|
|
|
|
|
|
|
|
|
|