Home / Function/ add_handler() — langchain Function Reference

add_handler() — langchain Function Reference

Architecture documentation for the add_handler() function in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  14741891_16ac_1712_0f46_0c996f33bf5f["add_handler()"]
  24bc19d6_d1f4_bd59_6fc4_6ef5b08a4d41["BaseCallbackManager"]
  14741891_16ac_1712_0f46_0c996f33bf5f -->|defined in| 24bc19d6_d1f4_bd59_6fc4_6ef5b08a4d41
  d3ca4cfe_17d5_f870_d94f_bf0e7595143d["set_handlers()"]
  d3ca4cfe_17d5_f870_d94f_bf0e7595143d -->|calls| 14741891_16ac_1712_0f46_0c996f33bf5f
  style 14741891_16ac_1712_0f46_0c996f33bf5f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/callbacks/base.py lines 1005–1019

    def add_handler(
        self,
        handler: BaseCallbackHandler,
        inherit: bool = True,  # noqa: FBT001,FBT002
    ) -> None:
        """Add a handler to the callback manager.

        Args:
            handler: The handler to add.
            inherit: Whether to inherit the handler.
        """
        if handler not in self.handlers:
            self.handlers.append(handler)
        if inherit and handler not in self.inheritable_handlers:
            self.inheritable_handlers.append(handler)

Domain

Subdomains

Called By

Frequently Asked Questions

What does add_handler() do?
add_handler() is a function in the langchain codebase, defined in libs/core/langchain_core/callbacks/base.py.
Where is add_handler() defined?
add_handler() is defined in libs/core/langchain_core/callbacks/base.py at line 1005.
What calls add_handler()?
add_handler() is called by 1 function(s): set_handlers.

Analyze Your Own Codebase

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

Try Supermodel Free