Home / Function/ afrom_documents() — langchain Function Reference

afrom_documents() — langchain Function Reference

Architecture documentation for the afrom_documents() function in vectorstore.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  8f610e64_87e6_8236_a6ba_d2b55ee64212["afrom_documents()"]
  bdf18ee2_fdaf_7d29_e84a_fd56c19ff238["VectorstoreIndexCreator"]
  8f610e64_87e6_8236_a6ba_d2b55ee64212 -->|defined in| bdf18ee2_fdaf_7d29_e84a_fd56c19ff238
  6419960d_4a05_1249_4fb9_bb60ae25805f["afrom_loaders()"]
  6419960d_4a05_1249_4fb9_bb60ae25805f -->|calls| 8f610e64_87e6_8236_a6ba_d2b55ee64212
  style 8f610e64_87e6_8236_a6ba_d2b55ee64212 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/indexes/vectorstore.py lines 253–271

    async def afrom_documents(
        self,
        documents: list[Document],
    ) -> VectorStoreIndexWrapper:
        """Asynchronously create a `VectorStore` index from a list of documents.

        Args:
            documents: A list of `Document` objects.

        Returns:
            A `VectorStoreIndexWrapper` containing the constructed vectorstore.
        """
        sub_docs = self.text_splitter.split_documents(documents)
        vectorstore = await self.vectorstore_cls.afrom_documents(
            sub_docs,
            self.embedding,
            **self.vectorstore_kwargs,
        )
        return VectorStoreIndexWrapper(vectorstore=vectorstore)

Domain

Subdomains

Called By

Frequently Asked Questions

What does afrom_documents() do?
afrom_documents() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/indexes/vectorstore.py.
Where is afrom_documents() defined?
afrom_documents() is defined in libs/langchain/langchain_classic/indexes/vectorstore.py at line 253.
What calls afrom_documents()?
afrom_documents() is called by 1 function(s): afrom_loaders.

Analyze Your Own Codebase

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

Try Supermodel Free