Home / Function/ astream() — langchain Function Reference

astream() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  c4bd9bb5_65d8_cf93_31b7_784cea5435ff["astream()"]
  65b9aaca_53f2_847d_9ab7_024fe53cbbd2["RouterRunnable"]
  c4bd9bb5_65d8_cf93_31b7_784cea5435ff -->|defined in| 65b9aaca_53f2_847d_9ab7_024fe53cbbd2
  style c4bd9bb5_65d8_cf93_31b7_784cea5435ff fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/runnables/router.py lines 225–239

    async def astream(
        self,
        input: RouterInput,
        config: RunnableConfig | None = None,
        **kwargs: Any | None,
    ) -> AsyncIterator[Output]:
        key = input["key"]
        actual_input = input["input"]
        if key not in self.runnables:
            msg = f"No runnable associated with key '{key}'"
            raise ValueError(msg)

        runnable = self.runnables[key]
        async for output in runnable.astream(actual_input, config):
            yield output

Domain

Subdomains

Frequently Asked Questions

What does astream() do?
astream() is a function in the langchain codebase, defined in libs/core/langchain_core/runnables/router.py.
Where is astream() defined?
astream() is defined in libs/core/langchain_core/runnables/router.py at line 225.

Analyze Your Own Codebase

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

Try Supermodel Free