Home / Function/ _astream() — langchain Function Reference

_astream() — langchain Function Reference

Architecture documentation for the _astream() function in test_base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  360a3b9c_a247_3d48_cdac_c5ef28482267["_astream()"]
  b2357da8_0aa2_69f5_db2e_2bc44a491cfb["ModelWithAsyncStream"]
  360a3b9c_a247_3d48_cdac_c5ef28482267 -->|defined in| b2357da8_0aa2_69f5_db2e_2bc44a491cfb
  eacfcca9_3369_1ec7_9552_9fa5fa1ec8a3["_astream()"]
  eacfcca9_3369_1ec7_9552_9fa5fa1ec8a3 -->|calls| 360a3b9c_a247_3d48_cdac_c5ef28482267
  de2021c5_a31f_b55f_eb9e_96aa9dd1a608["test_astream_implementation_uses_astream()"]
  de2021c5_a31f_b55f_eb9e_96aa9dd1a608 -->|calls| 360a3b9c_a247_3d48_cdac_c5ef28482267
  eacfcca9_3369_1ec7_9552_9fa5fa1ec8a3["_astream()"]
  360a3b9c_a247_3d48_cdac_c5ef28482267 -->|calls| eacfcca9_3369_1ec7_9552_9fa5fa1ec8a3
  style 360a3b9c_a247_3d48_cdac_c5ef28482267 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/language_models/chat_models/test_base.py lines 284–295

        async def _astream(
            self,
            messages: list[BaseMessage],
            stop: list[str] | None = None,
            run_manager: CallbackManagerForLLMRun | None = None,  # type: ignore[override]
            **kwargs: Any,
        ) -> AsyncIterator[ChatGenerationChunk]:
            """Stream the output of the model."""
            yield ChatGenerationChunk(message=AIMessageChunk(content="a"))
            yield ChatGenerationChunk(
                message=AIMessageChunk(content="b", chunk_position="last")
            )

Domain

Subdomains

Calls

Frequently Asked Questions

What does _astream() do?
_astream() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/language_models/chat_models/test_base.py.
Where is _astream() defined?
_astream() is defined in libs/core/tests/unit_tests/language_models/chat_models/test_base.py at line 284.
What does _astream() call?
_astream() calls 1 function(s): _astream.
What calls _astream()?
_astream() is called by 2 function(s): _astream, test_astream_implementation_uses_astream.

Analyze Your Own Codebase

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

Try Supermodel Free