Home / File/ __init__.py — langchain Source File

__init__.py — langchain Source File

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

File python CoreAbstractions Serialization 8 imports 3 functions

Entity Profile

Dependency Diagram

graph LR
  3df38564_0c39_bdcc_b1ed_f2de5e3f3baa["__init__.py"]
  8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"]
  3df38564_0c39_bdcc_b1ed_f2de5e3f3baa --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3
  923d222e_e249_1c30_4cfe_3c907f050b78["langchain_core._import_utils"]
  3df38564_0c39_bdcc_b1ed_f2de5e3f3baa --> 923d222e_e249_1c30_4cfe_3c907f050b78
  59d7001f_fb28_1819_31fc_7fb0380a8b32["langchain_core.tracers.base"]
  3df38564_0c39_bdcc_b1ed_f2de5e3f3baa --> 59d7001f_fb28_1819_31fc_7fb0380a8b32
  22dd83eb_d314_421f_51ef_473d1726f75f["langchain_core.tracers.evaluation"]
  3df38564_0c39_bdcc_b1ed_f2de5e3f3baa --> 22dd83eb_d314_421f_51ef_473d1726f75f
  ec9bee24_c773_b0b6_adc6_6ee890d32c05["langchain_core.tracers.langchain"]
  3df38564_0c39_bdcc_b1ed_f2de5e3f3baa --> ec9bee24_c773_b0b6_adc6_6ee890d32c05
  00303315_016c_bd4c_b122_eb71e173b0b6["langchain_core.tracers.log_stream"]
  3df38564_0c39_bdcc_b1ed_f2de5e3f3baa --> 00303315_016c_bd4c_b122_eb71e173b0b6
  17e2fb09_6b0f_338f_1319_77bc43602969["langchain_core.tracers.schemas"]
  3df38564_0c39_bdcc_b1ed_f2de5e3f3baa --> 17e2fb09_6b0f_338f_1319_77bc43602969
  8bf7b3ca_c639_e4bc_1078_4c3d567f3209["langchain_core.tracers.stdout"]
  3df38564_0c39_bdcc_b1ed_f2de5e3f3baa --> 8bf7b3ca_c639_e4bc_1078_4c3d567f3209
  style 3df38564_0c39_bdcc_b1ed_f2de5e3f3baa fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"""Tracers are classes for tracing runs."""

from typing import TYPE_CHECKING

from langchain_core._import_utils import import_attr

if TYPE_CHECKING:
    from langchain_core.tracers.base import BaseTracer
    from langchain_core.tracers.evaluation import EvaluatorCallbackHandler
    from langchain_core.tracers.langchain import LangChainTracer
    from langchain_core.tracers.log_stream import (
        LogStreamCallbackHandler,
        RunLog,
        RunLogPatch,
    )
    from langchain_core.tracers.schemas import Run
    from langchain_core.tracers.stdout import ConsoleCallbackHandler

__all__ = (
    "BaseTracer",
    "ConsoleCallbackHandler",
    "EvaluatorCallbackHandler",
    "LangChainTracer",
    "LogStreamCallbackHandler",
    "Run",
    "RunLog",
    "RunLogPatch",
)

_dynamic_imports = {
    "BaseTracer": "base",
    "EvaluatorCallbackHandler": "evaluation",
    "LangChainTracer": "langchain",
    "LogStreamCallbackHandler": "log_stream",
    "RunLog": "log_stream",
    "RunLogPatch": "log_stream",
    "Run": "schemas",
    "ConsoleCallbackHandler": "stdout",
}


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.tracers.base
  • langchain_core.tracers.evaluation
  • langchain_core.tracers.langchain
  • langchain_core.tracers.log_stream
  • langchain_core.tracers.schemas
  • langchain_core.tracers.stdout
  • 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 8 module(s): langchain_core._import_utils, langchain_core.tracers.base, langchain_core.tracers.evaluation, langchain_core.tracers.langchain, langchain_core.tracers.log_stream, langchain_core.tracers.schemas, langchain_core.tracers.stdout, typing.
Where is __init__.py in the architecture?
__init__.py is located at libs/core/langchain_core/tracers/__init__.py (domain: CoreAbstractions, subdomain: Serialization, directory: libs/core/langchain_core/tracers).

Analyze Your Own Codebase

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

Try Supermodel Free