From b925dac8b1b3b4cff1f1972a9644584d113fe3f6 Mon Sep 17 00:00:00 2001 From: Mohammad Mohtashim <45242107+keenborder786@users.noreply.github.com> Date: Thu, 19 Dec 2024 07:39:33 +0500 Subject: [PATCH] Removing `aadd_documents` to avoid Recursion Error (#29) A `RecursionError` was being thrown because `aadd_document` was calling `aadd_texts` without any changes in its implementation from `add_documents`. To resolve this, `aadd_document` was removed, preventing the `RecursionError`, and the base method from `VectorStore` is now used instead. Takes care of the following issue: https://github.com/langchain-ai/langchain/issues/28727 --- .../langchain_milvus/vectorstores/milvus.py | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/libs/milvus/langchain_milvus/vectorstores/milvus.py b/libs/milvus/langchain_milvus/vectorstores/milvus.py index 61fa109..bbcef1d 100644 --- a/libs/milvus/langchain_milvus/vectorstores/milvus.py +++ b/libs/milvus/langchain_milvus/vectorstores/milvus.py @@ -1541,21 +1541,6 @@ def add_documents(self, documents: List[Document], **kwargs: Any) -> List[str]: metadatas = [doc.metadata for doc in documents] return self.add_texts(texts, metadatas, **kwargs) - async def aadd_documents( - self, documents: List[Document], **kwargs: Any - ) -> List[str]: - """Run more documents through the embeddings and add to the vectorstore. - - Args: - documents: Documents to add to the vectorstore. - - Returns: - List of IDs of the added texts. - """ - texts = [doc.page_content for doc in documents] - metadatas = [doc.metadata for doc in documents] - return await self.aadd_texts(texts, metadatas, **kwargs) - def get_pks(self, expr: str, **kwargs: Any) -> List[int] | None: """Get primary keys with expression