Skip to content

The agent engineering platform.

docs: enhance docstring for `disable_streaming` parameter in BaseChatModel (#31759)

Mason Daugherty9aa75eaef387
diff --git a/libs/core/langchain_core/language_models/chat_models.py b/libs/core/langchain_core/language_models/chat_models.py
index f74270a9ac..2afa3bafea 100644
--- a/libs/core/langchain_core/language_models/chat_models.py
+++ b/libs/core/langchain_core/language_models/chat_models.py
@@ -300,9 +300,15 @@ class BaseChatModel(BaseLanguageModel[BaseMessage], ABC):
defer to ``invoke()``/``ainvoke()``.
- If True, will always bypass streaming case.
- - If "tool_calling", will bypass streaming case only when the model is called
- with a ``tools`` keyword argument.
+ - If ``'tool_calling'``, will bypass streaming case only when the model is called
+ with a ``tools`` keyword argument. In other words, LangChain will automatically
+ switch to non-streaming behavior (``invoke()``) only when the tools argument is
+ provided. This offers the best of both worlds.
- If False (default), will always use streaming case if available.
+
+ The main reason for this flag is that code might be written using ``.stream()`` and
+ a user may want to swap out a given model for another model whose the implementation
+ does not properly support streaming.
"""
@model_validator(mode="before")