__init__.py — langchain Source File
Architecture documentation for __init__.py, a python file in the langchain codebase. 13 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 74c9c18b_11c5_b8f7_0fac_e554bc0a732b["__init__.py"] f3365e3c_fb7a_bb9a_bc79_059b06cb7024["warnings"] 74c9c18b_11c5_b8f7_0fac_e554bc0a732b --> f3365e3c_fb7a_bb9a_bc79_059b06cb7024 3b5ab66f_4fcb_ca7c_bc35_2244b5f521fc["importlib"] 74c9c18b_11c5_b8f7_0fac_e554bc0a732b --> 3b5ab66f_4fcb_ca7c_bc35_2244b5f521fc feec1ec4_6917_867b_d228_b134d0ff8099["typing"] 74c9c18b_11c5_b8f7_0fac_e554bc0a732b --> feec1ec4_6917_867b_d228_b134d0ff8099 b869b9c1_fb7a_fbc5_c529_98b32cb76f64["langchain_core._api.deprecation"] 74c9c18b_11c5_b8f7_0fac_e554bc0a732b --> b869b9c1_fb7a_fbc5_c529_98b32cb76f64 064a3e08_287a_0c59_7629_2417af02571b["langchain_classic._api.interactive_env"] 74c9c18b_11c5_b8f7_0fac_e554bc0a732b --> 064a3e08_287a_0c59_7629_2417af02571b 138c8655_8752_7665_c90c_fe40e072df42["langchain_classic.agents"] 74c9c18b_11c5_b8f7_0fac_e554bc0a732b --> 138c8655_8752_7665_c90c_fe40e072df42 b3ba1570_8ee5_0263_3e06_a05d8e20d456["langchain_classic.chains"] 74c9c18b_11c5_b8f7_0fac_e554bc0a732b --> b3ba1570_8ee5_0263_3e06_a05d8e20d456 68a3bb7d_2735_287c_2742_fc2f8d9faa9e["langchain_community.docstore"] 74c9c18b_11c5_b8f7_0fac_e554bc0a732b --> 68a3bb7d_2735_287c_2742_fc2f8d9faa9e 843eba8a_f331_d3ef_f9ba_261ed9032f2a["langchain_community.llms"] 74c9c18b_11c5_b8f7_0fac_e554bc0a732b --> 843eba8a_f331_d3ef_f9ba_261ed9032f2a a2d69431_050d_f277_d355_f52831dcab75["langchain_community.llms.huggingface_pipeline"] 74c9c18b_11c5_b8f7_0fac_e554bc0a732b --> a2d69431_050d_f277_d355_f52831dcab75 435e49bf_bb2e_2016_ead7_0afb9d57ad71["langchain_core.prompts"] 74c9c18b_11c5_b8f7_0fac_e554bc0a732b --> 435e49bf_bb2e_2016_ead7_0afb9d57ad71 acd8d767_e952_a042_4fcf_15aa18858bfb["langchain_community.utilities"] 74c9c18b_11c5_b8f7_0fac_e554bc0a732b --> acd8d767_e952_a042_4fcf_15aa18858bfb bc17d2e1_7cf6_0264_36b7_5541fc5ef1dd["langchain_community.vectorstores"] 74c9c18b_11c5_b8f7_0fac_e554bc0a732b --> bc17d2e1_7cf6_0264_36b7_5541fc5ef1dd style 74c9c18b_11c5_b8f7_0fac_e554bc0a732b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"""Main entrypoint into package."""
import warnings
from importlib import metadata
from typing import Any
from langchain_core._api.deprecation import surface_langchain_deprecation_warnings
try:
__version__ = metadata.version(__package__)
except metadata.PackageNotFoundError:
# Case where package metadata is not available.
__version__ = ""
del metadata # optional, avoids polluting the results of dir(__package__)
def _warn_on_import(name: str, replacement: str | None = None) -> None:
"""Warn on import of deprecated module."""
from langchain_classic._api.interactive_env import is_interactive_env
if is_interactive_env():
# No warnings for interactive environments.
# This is done to avoid polluting the output of interactive environments
# where users rely on auto-complete and may trigger this warning
# even if they are not using any deprecated modules
return
if replacement:
warnings.warn(
f"Importing {name} from langchain root module is no longer supported. "
f"Please use {replacement} instead.",
stacklevel=3,
)
else:
warnings.warn(
f"Importing {name} from langchain root module is no longer supported.",
stacklevel=3,
)
# Surfaces Deprecation and Pending Deprecation warnings from langchain_classic.
surface_langchain_deprecation_warnings()
def __getattr__(name: str) -> Any:
if name == "MRKLChain":
from langchain_classic.agents import MRKLChain
_warn_on_import(name, replacement="langchain_classic.agents.MRKLChain")
return MRKLChain
if name == "ReActChain":
from langchain_classic.agents import ReActChain
_warn_on_import(name, replacement="langchain_classic.agents.ReActChain")
return ReActChain
if name == "SelfAskWithSearchChain":
from langchain_classic.agents import SelfAskWithSearchChain
// ... (365 more lines)
Domain
Subdomains
Dependencies
- importlib
- langchain_classic._api.interactive_env
- langchain_classic.agents
- langchain_classic.chains
- langchain_community.docstore
- langchain_community.llms
- langchain_community.llms.huggingface_pipeline
- langchain_community.utilities
- langchain_community.vectorstores
- langchain_core._api.deprecation
- langchain_core.prompts
- typing
- warnings
Source
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 LangChainCore domain, MessageInterface subdomain.
What functions are defined in __init__.py?
__init__.py defines 3 function(s): __getattr__, __version__, _warn_on_import.
What does __init__.py depend on?
__init__.py imports 13 module(s): importlib, langchain_classic._api.interactive_env, langchain_classic.agents, langchain_classic.chains, langchain_community.docstore, langchain_community.llms, langchain_community.llms.huggingface_pipeline, langchain_community.utilities, and 5 more.
Where is __init__.py in the architecture?
__init__.py is located at libs/langchain/langchain_classic/__init__.py (domain: LangChainCore, subdomain: MessageInterface, directory: libs/langchain/langchain_classic).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free