_stream() — langchain Function Reference
Architecture documentation for the _stream() function in chat_models.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 512ea4c4_540d_4115_afbf_5f3b5fca19ec["_stream()"] 48aa29b8_65e7_522f_a445_a441eeb6baff["BaseChatModel"] 512ea4c4_540d_4115_afbf_5f3b5fca19ec -->|defined in| 48aa29b8_65e7_522f_a445_a441eeb6baff 2c835c4d_6d4b_1dc6_028c_27710e69a32a["stream()"] 2c835c4d_6d4b_1dc6_028c_27710e69a32a -->|calls| 512ea4c4_540d_4115_afbf_5f3b5fca19ec 7f734836_7715_c31c_80ea_e14410d37d70["_generate_with_cache()"] 7f734836_7715_c31c_80ea_e14410d37d70 -->|calls| 512ea4c4_540d_4115_afbf_5f3b5fca19ec style 512ea4c4_540d_4115_afbf_5f3b5fca19ec fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/language_models/chat_models.py lines 1435–1453
def _stream(
self,
messages: list[BaseMessage],
stop: list[str] | None = None,
run_manager: CallbackManagerForLLMRun | None = None,
**kwargs: Any,
) -> Iterator[ChatGenerationChunk]:
"""Stream the output of the model.
Args:
messages: The messages to generate from.
stop: Optional list of stop words to use when generating.
run_manager: Optional callback manager to use for this call.
**kwargs: Additional keyword arguments to pass to the model.
Yields:
The chat generation chunks.
"""
raise NotImplementedError
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does _stream() do?
_stream() is a function in the langchain codebase, defined in libs/core/langchain_core/language_models/chat_models.py.
Where is _stream() defined?
_stream() is defined in libs/core/langchain_core/language_models/chat_models.py at line 1435.
What calls _stream()?
_stream() is called by 2 function(s): _generate_with_cache, stream.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free