Home / Function/ with_alisteners() — langchain Function Reference

with_alisteners() — langchain Function Reference

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

Function python LangChainCore Runnables calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  d8115a26_e832_7547_7ed4_30bb6e56dc99["with_alisteners()"]
  a94c7f6a_b072_1738_b1c2_2565e759189f["RunnableEach"]
  d8115a26_e832_7547_7ed4_30bb6e56dc99 -->|defined in| a94c7f6a_b072_1738_b1c2_2565e759189f
  0e7549cc_2910_8580_6919_c820637fdc82["with_alisteners()"]
  0e7549cc_2910_8580_6919_c820637fdc82 -->|calls| d8115a26_e832_7547_7ed4_30bb6e56dc99
  0e7549cc_2910_8580_6919_c820637fdc82["with_alisteners()"]
  d8115a26_e832_7547_7ed4_30bb6e56dc99 -->|calls| 0e7549cc_2910_8580_6919_c820637fdc82
  style d8115a26_e832_7547_7ed4_30bb6e56dc99 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/runnables/base.py lines 5496–5527

    def with_alisteners(
        self,
        *,
        on_start: AsyncListener | None = None,
        on_end: AsyncListener | None = None,
        on_error: AsyncListener | None = None,
    ) -> RunnableEach[Input, Output]:
        """Bind async lifecycle listeners to a `Runnable`.

        Returns a new `Runnable`.

        The `Run` object contains information about the run, including its `id`,
        `type`, `input`, `output`, `error`, `start_time`, `end_time`, and
        any tags or metadata added to the run.

        Args:
            on_start: Called asynchronously before the `Runnable` starts running,
                with the `Run` object.
            on_end: Called asynchronously after the `Runnable` finishes running,
                with the `Run` object.
            on_error: Called asynchronously if the `Runnable` throws an error,
                with the `Run` object.

        Returns:
            A new `Runnable` with the listeners bound.

        """
        return RunnableEach(
            bound=self.bound.with_alisteners(
                on_start=on_start, on_end=on_end, on_error=on_error
            )
        )

Domain

Subdomains

Called By

Frequently Asked Questions

What does with_alisteners() do?
with_alisteners() is a function in the langchain codebase, defined in libs/core/langchain_core/runnables/base.py.
Where is with_alisteners() defined?
with_alisteners() is defined in libs/core/langchain_core/runnables/base.py at line 5496.
What does with_alisteners() call?
with_alisteners() calls 1 function(s): with_alisteners.
What calls with_alisteners()?
with_alisteners() is called by 1 function(s): with_alisteners.

Analyze Your Own Codebase

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

Try Supermodel Free