Home / Function/ _stream() — langchain Function Reference

_stream() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  3b227c44_d18c_1d76_4ec4_040ff227b361["_stream()"]
  19e4be00_71fb_5390_6768_f6e6158f49b4["ChatOllama"]
  3b227c44_d18c_1d76_4ec4_040ff227b361 -->|defined in| 19e4be00_71fb_5390_6768_f6e6158f49b4
  3b4a8d88_e271_d530_a2cc_d47df386a668["_iterate_over_stream()"]
  3b227c44_d18c_1d76_4ec4_040ff227b361 -->|calls| 3b4a8d88_e271_d530_a2cc_d47df386a668
  style 3b227c44_d18c_1d76_4ec4_040ff227b361 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/ollama/langchain_ollama/chat_models.py lines 1112–1125

    def _stream(
        self,
        messages: list[BaseMessage],
        stop: list[str] | None = None,
        run_manager: CallbackManagerForLLMRun | None = None,
        **kwargs: Any,
    ) -> Iterator[ChatGenerationChunk]:
        for chunk in self._iterate_over_stream(messages, stop, **kwargs):
            if run_manager:
                run_manager.on_llm_new_token(
                    chunk.text,
                    verbose=self.verbose,
                )
            yield chunk

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free