Home / Function/ aadd_documents() — langchain Function Reference

aadd_documents() — langchain Function Reference

Architecture documentation for the aadd_documents() function in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  c79bd583_f243_61a3_9784_31be23df6e6b["aadd_documents()"]
  6c336ac6_f55c_1ad7_6db3_73dbd71fb625["VectorStore"]
  c79bd583_f243_61a3_9784_31be23df6e6b -->|defined in| 6c336ac6_f55c_1ad7_6db3_73dbd71fb625
  08a89237_e844_a3d9_353e_d89cd55c7b6a["aadd_texts()"]
  08a89237_e844_a3d9_353e_d89cd55c7b6a -->|calls| c79bd583_f243_61a3_9784_31be23df6e6b
  e5cf61af_382b_d2da_c38b_d74628394456["aadd_documents()"]
  e5cf61af_382b_d2da_c38b_d74628394456 -->|calls| c79bd583_f243_61a3_9784_31be23df6e6b
  08a89237_e844_a3d9_353e_d89cd55c7b6a["aadd_texts()"]
  c79bd583_f243_61a3_9784_31be23df6e6b -->|calls| 08a89237_e844_a3d9_353e_d89cd55c7b6a
  e5cf61af_382b_d2da_c38b_d74628394456["aadd_documents()"]
  c79bd583_f243_61a3_9784_31be23df6e6b -->|calls| e5cf61af_382b_d2da_c38b_d74628394456
  style c79bd583_f243_61a3_9784_31be23df6e6b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/vectorstores/base.py lines 265–291

    async def aadd_documents(
        self, documents: list[Document], **kwargs: Any
    ) -> list[str]:
        """Async run more documents through the embeddings and add to the `VectorStore`.

        Args:
            documents: Documents to add to the `VectorStore`.
            **kwargs: Additional keyword arguments.

        Returns:
            List of IDs of the added texts.
        """
        # If the async method has been overridden, we'll use that.
        if type(self).aadd_texts != VectorStore.aadd_texts:
            if "ids" not in kwargs:
                ids = [doc.id for doc in documents]

                # If there's at least one valid ID, we'll assume that IDs
                # should be used.
                if any(ids):
                    kwargs["ids"] = ids

            texts = [doc.page_content for doc in documents]
            metadatas = [doc.metadata for doc in documents]
            return await self.aadd_texts(texts, metadatas, **kwargs)

        return await run_in_executor(None, self.add_documents, documents, **kwargs)

Subdomains

Frequently Asked Questions

What does aadd_documents() do?
aadd_documents() is a function in the langchain codebase, defined in libs/core/langchain_core/vectorstores/base.py.
Where is aadd_documents() defined?
aadd_documents() is defined in libs/core/langchain_core/vectorstores/base.py at line 265.
What does aadd_documents() call?
aadd_documents() calls 2 function(s): aadd_documents, aadd_texts.
What calls aadd_documents()?
aadd_documents() is called by 2 function(s): aadd_documents, aadd_texts.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free