Home / Function/ aadd_documents() — langchain Function Reference

aadd_documents() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  c068c021_6d63_9a46_4f44_2d7d7141278d["aadd_documents()"]
  eb3f3ce7_75a2_f5aa_7781_56a2f86f1973["ParentDocumentRetriever"]
  c068c021_6d63_9a46_4f44_2d7d7141278d -->|defined in| eb3f3ce7_75a2_f5aa_7781_56a2f86f1973
  913129df_8767_b41b_518c_6c6d98c8bd9d["_split_docs_for_adding()"]
  c068c021_6d63_9a46_4f44_2d7d7141278d -->|calls| 913129df_8767_b41b_518c_6c6d98c8bd9d
  style c068c021_6d63_9a46_4f44_2d7d7141278d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/retrievers/parent_document_retriever.py lines 147–176

    async def aadd_documents(
        self,
        documents: list[Document],
        ids: list[str] | None = None,
        add_to_docstore: bool = True,  # noqa: FBT001,FBT002
        **kwargs: Any,
    ) -> None:
        """Adds documents to the docstore and vectorstores.

        Args:
            documents: List of documents to add
            ids: Optional list of IDs for documents. If provided should be the same
                length as the list of documents. Can be provided if parent documents
                are already in the document store and you don't want to re-add
                to the docstore. If not provided, random UUIDs will be used as
                idIDss.
            add_to_docstore: Boolean of whether to add documents to docstore.
                This can be false if and only if `ids` are provided. You may want
                to set this to False if the documents are already in the docstore
                and you don't want to re-add them.
            **kwargs: additional keyword arguments passed to the `VectorStore`.
        """
        docs, full_docs = self._split_docs_for_adding(
            documents,
            ids,
            add_to_docstore=add_to_docstore,
        )
        await self.vectorstore.aadd_documents(docs, **kwargs)
        if add_to_docstore:
            await self.docstore.amset(full_docs)

Domain

Subdomains

Frequently Asked Questions

What does aadd_documents() do?
aadd_documents() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/retrievers/parent_document_retriever.py.
Where is aadd_documents() defined?
aadd_documents() is defined in libs/langchain/langchain_classic/retrievers/parent_document_retriever.py at line 147.
What does aadd_documents() call?
aadd_documents() calls 1 function(s): _split_docs_for_adding.

Analyze Your Own Codebase

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

Try Supermodel Free