diff --git a/libs/core/langchain_core/language_models/chat_models.py b/libs/core/langchain_core/language_models/chat_models.py index f74270a9ac8..2afa3bafea1 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")