Skip to content

Commit 9aa75ea

Browse files
authored
docs: enhance docstring for disable_streaming parameter in BaseChatModel (#31759)
Resolves #31758
1 parent e8e89b0 commit 9aa75ea

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

libs/core/langchain_core/language_models/chat_models.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,15 @@ class BaseChatModel(BaseLanguageModel[BaseMessage], ABC):
300300
defer to ``invoke()``/``ainvoke()``.
301301
302302
- If True, will always bypass streaming case.
303-
- If "tool_calling", will bypass streaming case only when the model is called
304-
with a ``tools`` keyword argument.
303+
- If ``'tool_calling'``, will bypass streaming case only when the model is called
304+
with a ``tools`` keyword argument. In other words, LangChain will automatically
305+
switch to non-streaming behavior (``invoke()``) only when the tools argument is
306+
provided. This offers the best of both worlds.
305307
- If False (default), will always use streaming case if available.
308+
309+
The main reason for this flag is that code might be written using ``.stream()`` and
310+
a user may want to swap out a given model for another model whose the implementation
311+
does not properly support streaming.
306312
"""
307313

308314
@model_validator(mode="before")

0 commit comments

Comments
 (0)