Home / File/ __init__.py — langchain Source File

__init__.py — langchain Source File

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

File python CoreAbstractions Serialization 4 imports 3 functions

Entity Profile

Dependency Diagram

graph LR
  dc36c409_b9f1_ad53_e546_f7eb73489ba2["__init__.py"]
  8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"]
  dc36c409_b9f1_ad53_e546_f7eb73489ba2 --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3
  923d222e_e249_1c30_4cfe_3c907f050b78["langchain_core._import_utils"]
  dc36c409_b9f1_ad53_e546_f7eb73489ba2 --> 923d222e_e249_1c30_4cfe_3c907f050b78
  ddfa23f2_04c9_02fe_eeae_1d3018774560["langchain_core.embeddings.embeddings"]
  dc36c409_b9f1_ad53_e546_f7eb73489ba2 --> ddfa23f2_04c9_02fe_eeae_1d3018774560
  8c5f2c65_b0cc_2595_3d44_825c9bd061bc["langchain_core.embeddings.fake"]
  dc36c409_b9f1_ad53_e546_f7eb73489ba2 --> 8c5f2c65_b0cc_2595_3d44_825c9bd061bc
  style dc36c409_b9f1_ad53_e546_f7eb73489ba2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"""Embeddings."""

from typing import TYPE_CHECKING

from langchain_core._import_utils import import_attr

if TYPE_CHECKING:
    from langchain_core.embeddings.embeddings import Embeddings
    from langchain_core.embeddings.fake import (
        DeterministicFakeEmbedding,
        FakeEmbeddings,
    )

__all__ = ("DeterministicFakeEmbedding", "Embeddings", "FakeEmbeddings")

_dynamic_imports = {
    "Embeddings": "embeddings",
    "DeterministicFakeEmbedding": "fake",
    "FakeEmbeddings": "fake",
}


def __getattr__(attr_name: str) -> object:
    module_name = _dynamic_imports.get(attr_name)
    result = import_attr(attr_name, module_name, __spec__.parent)
    globals()[attr_name] = result
    return result


def __dir__() -> list[str]:
    return list(__all__)

Subdomains

Dependencies

  • langchain_core._import_utils
  • langchain_core.embeddings.embeddings
  • langchain_core.embeddings.fake
  • 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, Serialization subdomain.
What functions are defined in __init__.py?
__init__.py defines 3 function(s): __dir__, __getattr__, langchain_core.
What does __init__.py depend on?
__init__.py imports 4 module(s): langchain_core._import_utils, langchain_core.embeddings.embeddings, langchain_core.embeddings.fake, typing.
Where is __init__.py in the architecture?
__init__.py is located at libs/core/langchain_core/embeddings/__init__.py (domain: CoreAbstractions, subdomain: Serialization, directory: libs/core/langchain_core/embeddings).

Analyze Your Own Codebase

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

Try Supermodel Free