Home / Function/ _astream() — langchain Function Reference

_astream() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  26e3a369_7a57_42b1_3346_65f11015ffc2["_astream()"]
  a45c6745_da49_cdd1_be34_45a357868be5["GenericFakeChatModel"]
  26e3a369_7a57_42b1_3346_65f11015ffc2 -->|defined in| a45c6745_da49_cdd1_be34_45a357868be5
  style 26e3a369_7a57_42b1_3346_65f11015ffc2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/llms/fake_chat_model.py lines 201–218

    async def _astream(
        self,
        messages: list[BaseMessage],
        stop: list[str] | None = None,
        run_manager: AsyncCallbackManagerForLLMRun | None = None,
        **kwargs: Any,
    ) -> AsyncIterator[ChatGenerationChunk]:
        """Stream the output of the model."""
        result = await run_in_executor(
            None,
            self._stream,
            messages,
            stop=stop,
            run_manager=run_manager.get_sync() if run_manager else None,
            **kwargs,
        )
        for chunk in result:
            yield chunk

Domain

Subdomains

Frequently Asked Questions

What does _astream() do?
_astream() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/llms/fake_chat_model.py.
Where is _astream() defined?
_astream() is defined in libs/langchain/tests/unit_tests/llms/fake_chat_model.py at line 201.

Analyze Your Own Codebase

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

Try Supermodel Free