Home / Function/ load() — langchain Function Reference

load() — langchain Function Reference

Architecture documentation for the load() function in in_memory.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  f4bfdbd3_23c4_3881_3595_20a2e1be2b3c["load()"]
  6e491709_d60f_689d_8a1a_c760b54fd120["InMemoryVectorStore"]
  f4bfdbd3_23c4_3881_3595_20a2e1be2b3c -->|defined in| 6e491709_d60f_689d_8a1a_c760b54fd120
  style f4bfdbd3_23c4_3881_3595_20a2e1be2b3c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/vectorstores/in_memory.py lines 517–535

    def load(
        cls, path: str, embedding: Embeddings, **kwargs: Any
    ) -> InMemoryVectorStore:
        """Load a vector store from a file.

        Args:
            path: The path to load the vector store from.
            embedding: The embedding to use.
            **kwargs: Additional arguments to pass to the constructor.

        Returns:
            A `VectorStore` object.
        """
        path_: Path = Path(path)
        with path_.open("r", encoding="utf-8") as f:
            store = load(json.load(f), allowed_objects=[Document])
        vectorstore = cls(embedding=embedding, **kwargs)
        vectorstore.store = store
        return vectorstore

Subdomains

Frequently Asked Questions

What does load() do?
load() is a function in the langchain codebase, defined in libs/core/langchain_core/vectorstores/in_memory.py.
Where is load() defined?
load() is defined in libs/core/langchain_core/vectorstores/in_memory.py at line 517.

Analyze Your Own Codebase

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

Try Supermodel Free