register_configure_hook() — langchain Function Reference
Architecture documentation for the register_configure_hook() function in context.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD fa70a195_3653_2b1c_77c7_0a133d4c63ea["register_configure_hook()"] b631c948_af4b_1ae8_be2d_c334ff40ecef["context.py"] fa70a195_3653_2b1c_77c7_0a133d4c63ea -->|defined in| b631c948_af4b_1ae8_be2d_c334ff40ecef style fa70a195_3653_2b1c_77c7_0a133d4c63ea fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/tracers/context.py lines 171–202
def register_configure_hook(
context_var: ContextVar[Any | None],
inheritable: bool, # noqa: FBT001
handle_class: type[BaseCallbackHandler] | None = None,
env_var: str | None = None,
) -> None:
"""Register a configure hook.
Args:
context_var: The context variable.
inheritable: Whether the context variable is inheritable.
handle_class: The callback handler class.
env_var: The environment variable.
Raises:
ValueError: If `env_var` is set, `handle_class` must also be set to a non-`None`
value.
"""
if env_var is not None and handle_class is None:
msg = "If env_var is set, handle_class must also be set to a non-None value."
raise ValueError(msg)
_configure_hooks.append(
(
# the typings of ContextVar do not have the generic arg set as covariant
# so we have to cast it
cast("ContextVar[BaseCallbackHandler | None]", context_var),
inheritable,
handle_class,
env_var,
)
)
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does register_configure_hook() do?
register_configure_hook() is a function in the langchain codebase, defined in libs/core/langchain_core/tracers/context.py.
Where is register_configure_hook() defined?
register_configure_hook() is defined in libs/core/langchain_core/tracers/context.py at line 171.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free