_astream() — langchain Function Reference
Architecture documentation for the _astream() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD fe7d2227_7e9d_1aa6_e506_35d77859da4c["_astream()"] 29c504f8_01a0_5f4c_3ec6_14bbf14b96eb["ChatOpenAI"] fe7d2227_7e9d_1aa6_e506_35d77859da4c -->|defined in| 29c504f8_01a0_5f4c_3ec6_14bbf14b96eb 47573e6b_689c_1e1b_b035_1aee9c3d3bba["_astream()"] 47573e6b_689c_1e1b_b035_1aee9c3d3bba -->|calls| fe7d2227_7e9d_1aa6_e506_35d77859da4c 47573e6b_689c_1e1b_b035_1aee9c3d3bba["_astream()"] fe7d2227_7e9d_1aa6_e506_35d77859da4c -->|calls| 47573e6b_689c_1e1b_b035_1aee9c3d3bba f16a8c4e_203d_d4ca_56b2_d86075a05781["_astream_responses()"] fe7d2227_7e9d_1aa6_e506_35d77859da4c -->|calls| f16a8c4e_203d_d4ca_56b2_d86075a05781 e9866be0_b078_31ff_4159_1d040978b7e3["_use_responses_api()"] fe7d2227_7e9d_1aa6_e506_35d77859da4c -->|calls| e9866be0_b078_31ff_4159_1d040978b7e3 style fe7d2227_7e9d_1aa6_e506_35d77859da4c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/openai/langchain_openai/chat_models/base.py lines 3069–3078
async def _astream(
self, *args: Any, **kwargs: Any
) -> AsyncIterator[ChatGenerationChunk]:
"""Route to Chat Completions or Responses API."""
if self._use_responses_api({**kwargs, **self.model_kwargs}):
async for chunk in super()._astream_responses(*args, **kwargs):
yield chunk
else:
async for chunk in super()._astream(*args, **kwargs):
yield chunk
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does _astream() do?
_astream() is a function in the langchain codebase, defined in libs/partners/openai/langchain_openai/chat_models/base.py.
Where is _astream() defined?
_astream() is defined in libs/partners/openai/langchain_openai/chat_models/base.py at line 3069.
What does _astream() call?
_astream() calls 3 function(s): _astream, _astream_responses, _use_responses_api.
What calls _astream()?
_astream() is called by 1 function(s): _astream.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free