Home / File/ __init__.py — langchain Source File

__init__.py — langchain Source File

Architecture documentation for __init__.py, a python file in the langchain codebase. 6 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  8eae0ede_bbba_6f14_cc2c_d5cbad5456e2["__init__.py"]
  8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"]
  8eae0ede_bbba_6f14_cc2c_d5cbad5456e2 --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3
  ffb0de41_b0f2_997d_ad3d_1a29fba34ab1["langchain_core.indexing.api"]
  8eae0ede_bbba_6f14_cc2c_d5cbad5456e2 --> ffb0de41_b0f2_997d_ad3d_1a29fba34ab1
  439a4142_6fa6_fe9a_2cba_7c9fb0cdceb7["langchain_classic._api"]
  8eae0ede_bbba_6f14_cc2c_d5cbad5456e2 --> 439a4142_6fa6_fe9a_2cba_7c9fb0cdceb7
  1b0ae2ed_cca0_9671_eee5_f23b62c4f004["langchain_classic.indexes._sql_record_manager"]
  8eae0ede_bbba_6f14_cc2c_d5cbad5456e2 --> 1b0ae2ed_cca0_9671_eee5_f23b62c4f004
  b157f6a3_5a63_aa53_86de_23d2e974972d["langchain_classic.indexes.vectorstore"]
  8eae0ede_bbba_6f14_cc2c_d5cbad5456e2 --> b157f6a3_5a63_aa53_86de_23d2e974972d
  25c5a635_5db9_4b69_8c55_f2cecce65f9c["langchain_community.graphs.index_creator"]
  8eae0ede_bbba_6f14_cc2c_d5cbad5456e2 --> 25c5a635_5db9_4b69_8c55_f2cecce65f9c
  style 8eae0ede_bbba_6f14_cc2c_d5cbad5456e2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"""**Indexes**.

**Index** is used to avoid writing duplicated content
into the vectostore and to avoid over-writing content if it's unchanged.

Indexes also :

* Create knowledge graphs from data.

* Support indexing workflows from LangChain data loaders to vectorstores.

Importantly, Index keeps on working even if the content being written is derived
via a set of transformations from some source content (e.g., indexing children
documents that were derived from parent documents by chunking.)
"""

from typing import TYPE_CHECKING, Any

from langchain_core.indexing.api import IndexingResult, aindex, index

from langchain_classic._api import create_importer
from langchain_classic.indexes._sql_record_manager import SQLRecordManager
from langchain_classic.indexes.vectorstore import VectorstoreIndexCreator

if TYPE_CHECKING:
    from langchain_community.graphs.index_creator import GraphIndexCreator


# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATED_LOOKUP = {
    "GraphIndexCreator": "langchain_community.graphs.index_creator",
}

_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)


def __getattr__(name: str) -> Any:
    """Look up attributes dynamically."""
    return _import_attribute(name)


__all__ = [
    "GraphIndexCreator",
    "IndexingResult",
    "SQLRecordManager",
    "VectorstoreIndexCreator",
    # Keep sorted
    "aindex",
    "index",
]

Subdomains

Dependencies

  • langchain_classic._api
  • langchain_classic.indexes._sql_record_manager
  • langchain_classic.indexes.vectorstore
  • langchain_community.graphs.index_creator
  • langchain_core.indexing.api
  • typing

Frequently Asked Questions

What does __init__.py do?
__init__.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, RunnableInterface subdomain.
What functions are defined in __init__.py?
__init__.py defines 2 function(s): __getattr__, langchain_community.
What does __init__.py depend on?
__init__.py imports 6 module(s): langchain_classic._api, langchain_classic.indexes._sql_record_manager, langchain_classic.indexes.vectorstore, langchain_community.graphs.index_creator, langchain_core.indexing.api, typing.
Where is __init__.py in the architecture?
__init__.py is located at libs/langchain/langchain_classic/indexes/__init__.py (domain: CoreAbstractions, subdomain: RunnableInterface, directory: libs/langchain/langchain_classic/indexes).

Analyze Your Own Codebase

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

Try Supermodel Free