diff --git a/libs/astradb/langchain_astradb/graph_vectorstores.py b/libs/astradb/langchain_astradb/graph_vectorstores.py index a50bcd0..69a198c 100644 --- a/libs/astradb/langchain_astradb/graph_vectorstores.py +++ b/libs/astradb/langchain_astradb/graph_vectorstores.py @@ -329,7 +329,7 @@ def __init__( self.astra_env = self.vector_store.astra_env - def get_metadata_for_insertion(self, doc: Document) -> dict[str, Any]: + def _get_metadata_for_insertion(self, doc: Document) -> dict[str, Any]: """Prepares the links in a document by serializing them to metadata. Args: @@ -346,7 +346,7 @@ def get_metadata_for_insertion(self, doc: Document) -> dict[str, Any]: ] return metadata - def restore_links(self, doc: Document) -> Document: + def _restore_links(self, doc: Document) -> Document: """Restores links in a document by deserializing them from metadata. Args: @@ -360,7 +360,7 @@ def restore_links(self, doc: Document) -> Document: doc.metadata.pop(self.metadata_incoming_links_key) return doc - def get_metadata_filter( + def _get_metadata_filter( self, metadata: dict[str, Any] | None = None, outgoing_link: Link | None = None, @@ -446,7 +446,10 @@ def from_documents( collection_embedding_api_key=collection_embedding_api_key, **kwargs, ) - store.add_documents(documents, ids=ids) + if ids is None: + store.add_documents(documents) + else: + store.add_documents(documents, ids=ids) return store @classmethod @@ -468,5 +471,8 @@ async def afrom_documents( setup_mode=SetupMode.ASYNC, **kwargs, ) - await store.aadd_documents(documents, ids=ids) + if ids is None: + await store.aadd_documents(documents) + else: + await store.aadd_documents(documents, ids=ids) return store diff --git a/libs/astradb/poetry.lock b/libs/astradb/poetry.lock index 1143d2b..328c3b5 100644 --- a/libs/astradb/poetry.lock +++ b/libs/astradb/poetry.lock @@ -853,7 +853,7 @@ tenacity = ">=8.1.0,!=8.4.0,<10" type = "git" url = "https://github.com/epinzur/langchain.git" reference = "remove_nodes" -resolved_reference = "fa8d3231253f7be9b16d9df50f679519d53a639e" +resolved_reference = "137825f55a39e5dd1b33e13451743636c08fcb62" subdirectory = "libs/community" [[package]]