Home / Function/ from_documents() — langchain Function Reference

from_documents() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  8d36c2d1_82c3_104b_ff62_3f6b01aeda59["from_documents()"]
  bdf18ee2_fdaf_7d29_e84a_fd56c19ff238["VectorstoreIndexCreator"]
  8d36c2d1_82c3_104b_ff62_3f6b01aeda59 -->|defined in| bdf18ee2_fdaf_7d29_e84a_fd56c19ff238
  591eea90_d694_aec1_e19f_c7276c2ffd51["from_loaders()"]
  591eea90_d694_aec1_e19f_c7276c2ffd51 -->|calls| 8d36c2d1_82c3_104b_ff62_3f6b01aeda59
  style 8d36c2d1_82c3_104b_ff62_3f6b01aeda59 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/indexes/vectorstore.py lines 236–251

    def from_documents(self, documents: list[Document]) -> VectorStoreIndexWrapper:
        """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 = self.vectorstore_cls.from_documents(
            sub_docs,
            self.embedding,
            **self.vectorstore_kwargs,
        )
        return VectorStoreIndexWrapper(vectorstore=vectorstore)

Domain

Subdomains

Called By

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free