Home / Function/ _stream() — langchain Function Reference

_stream() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  6eabc4a9_2f10_b00f_2edb_18c7de5ad41d["_stream()"]
  29c504f8_01a0_5f4c_3ec6_14bbf14b96eb["ChatOpenAI"]
  6eabc4a9_2f10_b00f_2edb_18c7de5ad41d -->|defined in| 29c504f8_01a0_5f4c_3ec6_14bbf14b96eb
  eee344d5_cb34_d6fa_ca18_010bbd1e6cd0["_stream()"]
  eee344d5_cb34_d6fa_ca18_010bbd1e6cd0 -->|calls| 6eabc4a9_2f10_b00f_2edb_18c7de5ad41d
  eee344d5_cb34_d6fa_ca18_010bbd1e6cd0["_stream()"]
  6eabc4a9_2f10_b00f_2edb_18c7de5ad41d -->|calls| eee344d5_cb34_d6fa_ca18_010bbd1e6cd0
  ad60e96a_ba3b_fa9d_754c_16ef8861396c["_stream_responses()"]
  6eabc4a9_2f10_b00f_2edb_18c7de5ad41d -->|calls| ad60e96a_ba3b_fa9d_754c_16ef8861396c
  e9866be0_b078_31ff_4159_1d040978b7e3["_use_responses_api()"]
  6eabc4a9_2f10_b00f_2edb_18c7de5ad41d -->|calls| e9866be0_b078_31ff_4159_1d040978b7e3
  style 6eabc4a9_2f10_b00f_2edb_18c7de5ad41d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/openai/langchain_openai/chat_models/base.py lines 3063–3067

    def _stream(self, *args: Any, **kwargs: Any) -> Iterator[ChatGenerationChunk]:
        """Route to Chat Completions or Responses API."""
        if self._use_responses_api({**kwargs, **self.model_kwargs}):
            return super()._stream_responses(*args, **kwargs)
        return super()._stream(*args, **kwargs)

Domain

Subdomains

Called By

Frequently Asked Questions

What does _stream() do?
_stream() is a function in the langchain codebase, defined in libs/partners/openai/langchain_openai/chat_models/base.py.
Where is _stream() defined?
_stream() is defined in libs/partners/openai/langchain_openai/chat_models/base.py at line 3063.
What does _stream() call?
_stream() calls 3 function(s): _stream, _stream_responses, _use_responses_api.
What calls _stream()?
_stream() is called by 1 function(s): _stream.

Analyze Your Own Codebase

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

Try Supermodel Free