Home / Class/ MyCustomAsyncHandler Class — langchain Architecture

MyCustomAsyncHandler Class — langchain Architecture

Architecture documentation for the MyCustomAsyncHandler class in test_async_callbacks.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  48f040a3_2205_5d5a_3161_82a327c126cf["MyCustomAsyncHandler"]
  64513429_d001_87b1_5f19_cc17a3f3577b["AsyncCallbackHandler"]
  48f040a3_2205_5d5a_3161_82a327c126cf -->|extends| 64513429_d001_87b1_5f19_cc17a3f3577b
  0976f644_8566_afee_cf50_f48330be7127["test_async_callbacks.py"]
  48f040a3_2205_5d5a_3161_82a327c126cf -->|defined in| 0976f644_8566_afee_cf50_f48330be7127
  3836c841_df73_69f9_bf52_a6d4697b3cde["on_chat_model_start()"]
  48f040a3_2205_5d5a_3161_82a327c126cf -->|method| 3836c841_df73_69f9_bf52_a6d4697b3cde
  fe20e017_8f46_e9e2_7b92_156ad8f09790["on_llm_new_token()"]
  48f040a3_2205_5d5a_3161_82a327c126cf -->|method| fe20e017_8f46_e9e2_7b92_156ad8f09790

Relationship Graph

Source Code

libs/core/tests/benchmarks/test_async_callbacks.py lines 16–44

class MyCustomAsyncHandler(AsyncCallbackHandler):
    @override
    async def on_chat_model_start(
        self,
        serialized: dict[str, Any],
        messages: list[list[BaseMessage]],
        *,
        run_id: UUID,
        parent_run_id: UUID | None = None,
        tags: list[str] | None = None,
        metadata: dict[str, Any] | None = None,
        **kwargs: Any,
    ) -> Any:
        # Do nothing
        # Required to implement since this is an abstract method
        pass

    @override
    async def on_llm_new_token(
        self,
        token: str,
        *,
        chunk: GenerationChunk | ChatGenerationChunk | None = None,
        run_id: UUID,
        parent_run_id: UUID | None = None,
        tags: list[str] | None = None,
        **kwargs: Any,
    ) -> None:
        await asyncio.sleep(0)

Frequently Asked Questions

What is the MyCustomAsyncHandler class?
MyCustomAsyncHandler is a class in the langchain codebase, defined in libs/core/tests/benchmarks/test_async_callbacks.py.
Where is MyCustomAsyncHandler defined?
MyCustomAsyncHandler is defined in libs/core/tests/benchmarks/test_async_callbacks.py at line 16.
What does MyCustomAsyncHandler extend?
MyCustomAsyncHandler extends AsyncCallbackHandler.

Analyze Your Own Codebase

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

Try Supermodel Free