Home / Function/ astream() — langchain Function Reference

astream() — langchain Function Reference

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

Function python LangChainCore Runnables calls 2 called by 2

Entity Profile

Dependency Diagram

graph TD
  d04ee734_b887_f11d_7551_064b5b024357["astream()"]
  4a62481c_02cb_a5de_1833_50669d5351a6["Runnable"]
  d04ee734_b887_f11d_7551_064b5b024357 -->|defined in| 4a62481c_02cb_a5de_1833_50669d5351a6
  3673596e_21a0_2e75_b2b6_4e0b42a59cee["atransform()"]
  3673596e_21a0_2e75_b2b6_4e0b42a59cee -->|calls| d04ee734_b887_f11d_7551_064b5b024357
  15baef27_1ae6_bb17_544d_cf6d5de2570c["astream()"]
  15baef27_1ae6_bb17_544d_cf6d5de2570c -->|calls| d04ee734_b887_f11d_7551_064b5b024357
  b48e63b1_c802_57f5_1432_79f235cc1161["ainvoke()"]
  d04ee734_b887_f11d_7551_064b5b024357 -->|calls| b48e63b1_c802_57f5_1432_79f235cc1161
  15baef27_1ae6_bb17_544d_cf6d5de2570c["astream()"]
  d04ee734_b887_f11d_7551_064b5b024357 -->|calls| 15baef27_1ae6_bb17_544d_cf6d5de2570c
  style d04ee734_b887_f11d_7551_064b5b024357 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/runnables/base.py lines 1151–1170

    async def astream(
        self,
        input: Input,
        config: RunnableConfig | None = None,
        **kwargs: Any | None,
    ) -> AsyncIterator[Output]:
        """Default implementation of `astream`, which calls `ainvoke`.

        Subclasses must override this method if they support streaming output.

        Args:
            input: The input to the `Runnable`.
            config: The config to use for the `Runnable`.
            **kwargs: Additional keyword arguments to pass to the `Runnable`.

        Yields:
            The output of the `Runnable`.

        """
        yield await self.ainvoke(input, config, **kwargs)

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free