Home / Function/ _astream() — langchain Function Reference

_astream() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  d3156d7d_2212_27d9_1af7_5f566188d094["_astream()"]
  19e4be00_71fb_5390_6768_f6e6158f49b4["ChatOllama"]
  d3156d7d_2212_27d9_1af7_5f566188d094 -->|defined in| 19e4be00_71fb_5390_6768_f6e6158f49b4
  99d71779_02a3_5ac1_9f57_f8b40ddef80e["_aiterate_over_stream()"]
  d3156d7d_2212_27d9_1af7_5f566188d094 -->|calls| 99d71779_02a3_5ac1_9f57_f8b40ddef80e
  style d3156d7d_2212_27d9_1af7_5f566188d094 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/ollama/langchain_ollama/chat_models.py lines 1189–1202

    async def _astream(
        self,
        messages: list[BaseMessage],
        stop: list[str] | None = None,
        run_manager: AsyncCallbackManagerForLLMRun | None = None,
        **kwargs: Any,
    ) -> AsyncIterator[ChatGenerationChunk]:
        async for chunk in self._aiterate_over_stream(messages, stop, **kwargs):
            if run_manager:
                await run_manager.on_llm_new_token(
                    chunk.text,
                    verbose=self.verbose,
                )
            yield chunk

Domain

Subdomains

Frequently Asked Questions

What does _astream() do?
_astream() is a function in the langchain codebase, defined in libs/partners/ollama/langchain_ollama/chat_models.py.
Where is _astream() defined?
_astream() is defined in libs/partners/ollama/langchain_ollama/chat_models.py at line 1189.
What does _astream() call?
_astream() calls 1 function(s): _aiterate_over_stream.

Analyze Your Own Codebase

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

Try Supermodel Free