Home / Function/ stream() — langchain Function Reference

stream() — langchain Function Reference

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

Function python LangChainCore Runnables calls 2 called by 2

Entity Profile

Dependency Diagram

graph TD
  66bfa0c6_f60c_67bd_cbc1_53b945547106["stream()"]
  4a62481c_02cb_a5de_1833_50669d5351a6["Runnable"]
  66bfa0c6_f60c_67bd_cbc1_53b945547106 -->|defined in| 4a62481c_02cb_a5de_1833_50669d5351a6
  ec8ef184_f283_14ce_8075_7b1a5a02aeee["transform()"]
  ec8ef184_f283_14ce_8075_7b1a5a02aeee -->|calls| 66bfa0c6_f60c_67bd_cbc1_53b945547106
  313003d8_974a_aa13_44c6_b92dc6cc69de["stream()"]
  313003d8_974a_aa13_44c6_b92dc6cc69de -->|calls| 66bfa0c6_f60c_67bd_cbc1_53b945547106
  e2ca1dd3_4ae9_2ab3_37d2_60242857703f["invoke()"]
  66bfa0c6_f60c_67bd_cbc1_53b945547106 -->|calls| e2ca1dd3_4ae9_2ab3_37d2_60242857703f
  313003d8_974a_aa13_44c6_b92dc6cc69de["stream()"]
  66bfa0c6_f60c_67bd_cbc1_53b945547106 -->|calls| 313003d8_974a_aa13_44c6_b92dc6cc69de
  style 66bfa0c6_f60c_67bd_cbc1_53b945547106 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/runnables/base.py lines 1130–1149

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

        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 self.invoke(input, config, **kwargs)

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free