Home / Class/ CustomHandler Class — langchain Architecture

CustomHandler Class — langchain Architecture

Architecture documentation for the CustomHandler class in test_async_callback_manager.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  da945e6d_2d8b_640e_5b6c_6ea1e0cdc9d9["CustomHandler"]
  64513429_d001_87b1_5f19_cc17a3f3577b["AsyncCallbackHandler"]
  da945e6d_2d8b_640e_5b6c_6ea1e0cdc9d9 -->|extends| 64513429_d001_87b1_5f19_cc17a3f3577b
  f1a09d1e_2693_1456_76d6_3f34ca061a65["test_async_callback_manager.py"]
  da945e6d_2d8b_640e_5b6c_6ea1e0cdc9d9 -->|defined in| f1a09d1e_2693_1456_76d6_3f34ca061a65
  79694206_c7da_0d68_dfbe_989f2343a290["__init__()"]
  da945e6d_2d8b_640e_5b6c_6ea1e0cdc9d9 -->|method| 79694206_c7da_0d68_dfbe_989f2343a290
  fdcaaad0_e09a_41dc_1031_f54f3bb1a8a7["on_llm_start()"]
  da945e6d_2d8b_640e_5b6c_6ea1e0cdc9d9 -->|method| fdcaaad0_e09a_41dc_1031_f54f3bb1a8a7

Relationship Graph

Source Code

libs/core/tests/unit_tests/callbacks/test_async_callback_manager.py lines 39–53

    class CustomHandler(AsyncCallbackHandler):
        """A handler that sets the context variable.

        The handler sets the context variable to the name of the callback that was
        called.
        """

        def __init__(self, *, run_inline: bool) -> None:
            """Initialize the handler."""
            self.run_inline = run_inline

        @override
        async def on_llm_start(self, *args: Any, **kwargs: Any) -> None:
            """Update the callstack with the name of the callback."""
            some_var.set("on_llm_start")

Frequently Asked Questions

What is the CustomHandler class?
CustomHandler is a class in the langchain codebase, defined in libs/core/tests/unit_tests/callbacks/test_async_callback_manager.py.
Where is CustomHandler defined?
CustomHandler is defined in libs/core/tests/unit_tests/callbacks/test_async_callback_manager.py at line 39.
What does CustomHandler extend?
CustomHandler extends AsyncCallbackHandler.

Analyze Your Own Codebase

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

Try Supermodel Free