__init__.py — langchain Source File
Architecture documentation for __init__.py, a python file in the langchain codebase. 11 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 24deccf9_f836_1d07_f2c9_d8e47e5705fd["__init__.py"] 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"] 24deccf9_f836_1d07_f2c9_d8e47e5705fd --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3 923d222e_e249_1c30_4cfe_3c907f050b78["langchain_core._import_utils"] 24deccf9_f836_1d07_f2c9_d8e47e5705fd --> 923d222e_e249_1c30_4cfe_3c907f050b78 f4d905c6_a2b2_eb8f_be9b_7808b72f6a16["langchain_core.utils"] 24deccf9_f836_1d07_f2c9_d8e47e5705fd --> f4d905c6_a2b2_eb8f_be9b_7808b72f6a16 093e7fce_331f_eaa8_76e6_694099ef19a1["langchain_core.utils.aiter"] 24deccf9_f836_1d07_f2c9_d8e47e5705fd --> 093e7fce_331f_eaa8_76e6_694099ef19a1 2b0178a6_7392_5ad0_fa5a_1b8582a9d85c["langchain_core.utils.env"] 24deccf9_f836_1d07_f2c9_d8e47e5705fd --> 2b0178a6_7392_5ad0_fa5a_1b8582a9d85c 5d3a2459_089e_5f20_61eb_223262657e65["langchain_core.utils.formatting"] 24deccf9_f836_1d07_f2c9_d8e47e5705fd --> 5d3a2459_089e_5f20_61eb_223262657e65 75b56223_6cf5_b347_8586_de20156157a1["langchain_core.utils.input"] 24deccf9_f836_1d07_f2c9_d8e47e5705fd --> 75b56223_6cf5_b347_8586_de20156157a1 fb97a5dd_8baa_cbb1_1219_066aff1f076c["langchain_core.utils.iter"] 24deccf9_f836_1d07_f2c9_d8e47e5705fd --> fb97a5dd_8baa_cbb1_1219_066aff1f076c 1014fe78_cb2c_fde4_a624_ae899aa7ca8e["langchain_core.utils.pydantic"] 24deccf9_f836_1d07_f2c9_d8e47e5705fd --> 1014fe78_cb2c_fde4_a624_ae899aa7ca8e 4908f59c_c377_4cb1_33a4_79167584d4db["langchain_core.utils.strings"] 24deccf9_f836_1d07_f2c9_d8e47e5705fd --> 4908f59c_c377_4cb1_33a4_79167584d4db afb01135_7b40_b00b_9769_21eebcc09aa3["langchain_core.utils.utils"] 24deccf9_f836_1d07_f2c9_d8e47e5705fd --> afb01135_7b40_b00b_9769_21eebcc09aa3 style 24deccf9_f836_1d07_f2c9_d8e47e5705fd fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"""Utility functions for LangChain.
These functions do not depend on any other LangChain module.
"""
from typing import TYPE_CHECKING
from langchain_core._import_utils import import_attr
if TYPE_CHECKING:
# for type checking and IDE support, we include the imports here
# but we don't want to eagerly import them at runtime
from langchain_core.utils import image
from langchain_core.utils.aiter import abatch_iterate
from langchain_core.utils.env import get_from_dict_or_env, get_from_env
from langchain_core.utils.formatting import StrictFormatter, formatter
from langchain_core.utils.input import (
get_bolded_text,
get_color_mapping,
get_colored_text,
print_text,
)
from langchain_core.utils.iter import batch_iterate
from langchain_core.utils.pydantic import pre_init
from langchain_core.utils.strings import (
comma_list,
sanitize_for_postgres,
stringify_dict,
stringify_value,
)
from langchain_core.utils.utils import (
build_extra_kwargs,
check_package_version,
convert_to_secret_str,
from_env,
get_pydantic_field_names,
guard_import,
mock_now,
raise_for_status_with_text,
secret_from_env,
xor_args,
)
__all__ = (
"StrictFormatter",
"abatch_iterate",
"batch_iterate",
"build_extra_kwargs",
"check_package_version",
"comma_list",
"convert_to_secret_str",
"formatter",
"from_env",
"get_bolded_text",
"get_color_mapping",
"get_colored_text",
"get_from_dict_or_env",
"get_from_env",
"get_pydantic_field_names",
"guard_import",
"image",
"mock_now",
"pre_init",
"print_text",
"raise_for_status_with_text",
"sanitize_for_postgres",
"secret_from_env",
"stringify_dict",
"stringify_value",
"xor_args",
)
_dynamic_imports = {
"image": "__module__",
"abatch_iterate": "aiter",
"get_from_dict_or_env": "env",
"get_from_env": "env",
"StrictFormatter": "formatting",
"formatter": "formatting",
"get_bolded_text": "input",
"get_color_mapping": "input",
"get_colored_text": "input",
"print_text": "input",
"batch_iterate": "iter",
"pre_init": "pydantic",
"comma_list": "strings",
"sanitize_for_postgres": "strings",
"stringify_dict": "strings",
"stringify_value": "strings",
"build_extra_kwargs": "utils",
"check_package_version": "utils",
"convert_to_secret_str": "utils",
"from_env": "utils",
"get_pydantic_field_names": "utils",
"guard_import": "utils",
"mock_now": "utils",
"secret_from_env": "utils",
"xor_args": "utils",
"raise_for_status_with_text": "utils",
}
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__)
Domain
Subdomains
Functions
Dependencies
- langchain_core._import_utils
- langchain_core.utils
- langchain_core.utils.aiter
- langchain_core.utils.env
- langchain_core.utils.formatting
- langchain_core.utils.input
- langchain_core.utils.iter
- langchain_core.utils.pydantic
- langchain_core.utils.strings
- langchain_core.utils.utils
- typing
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 CoreAbstractions domain, RunnableInterface 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 11 module(s): langchain_core._import_utils, langchain_core.utils, langchain_core.utils.aiter, langchain_core.utils.env, langchain_core.utils.formatting, langchain_core.utils.input, langchain_core.utils.iter, langchain_core.utils.pydantic, and 3 more.
Where is __init__.py in the architecture?
__init__.py is located at libs/core/langchain_core/utils/__init__.py (domain: CoreAbstractions, subdomain: RunnableInterface, directory: libs/core/langchain_core/utils).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free