From 29c58528c72abd59d69e0c64bffe4920b8031685 Mon Sep 17 00:00:00 2001 From: Christophe Bornet Date: Tue, 26 Mar 2024 15:03:22 +0100 Subject: [PATCH] core[minor]: Add default implementations to amax_marginal_relevance_search_by_vector and adelete (#19269) --- libs/core/langchain_core/vectorstores.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libs/core/langchain_core/vectorstores.py b/libs/core/langchain_core/vectorstores.py index 4f8cf81b0c9..64713c0139f 100644 --- a/libs/core/langchain_core/vectorstores.py +++ b/libs/core/langchain_core/vectorstores.py @@ -112,8 +112,7 @@ class VectorStore(ABC): Optional[bool]: True if deletion is successful, False otherwise, None if not implemented. """ - - raise NotImplementedError("delete method must be implemented by subclass.") + return await run_in_executor(None, self.delete, ids, **kwargs) async def aadd_texts( self, @@ -513,7 +512,15 @@ class VectorStore(ABC): **kwargs: Any, ) -> List[Document]: """Return docs selected using the maximal marginal relevance.""" - raise NotImplementedError + return await run_in_executor( + None, + self.max_marginal_relevance_search_by_vector, + embedding, + k=k, + fetch_k=fetch_k, + lambda_mult=lambda_mult, + **kwargs, + ) @classmethod def from_documents(