diff --git a/libs/partners/ollama/langchain_ollama/chat_models.py b/libs/partners/ollama/langchain_ollama/chat_models.py index 2565660a4c472..b4f8c0f2d9aab 100644 --- a/libs/partners/ollama/langchain_ollama/chat_models.py +++ b/libs/partners/ollama/langchain_ollama/chat_models.py @@ -306,8 +306,6 @@ class ChatOllama(BaseChatModel): '{"location": "Pune, India", "time_of_day": "morning"}' Tool Calling: - .. warning:: - Ollama currently does not support streaming for tools .. code-block:: python @@ -459,12 +457,9 @@ def _chat_params( }, ) - tools = kwargs.get("tools") - default_stream = not bool(tools) - params = { "messages": ollama_messages, - "stream": kwargs.pop("stream", default_stream), + "stream": kwargs.pop("stream", True), "model": kwargs.pop("model", self.model), "format": kwargs.pop("format", self.format), "options": Options(**options_dict), @@ -472,7 +467,7 @@ def _chat_params( **kwargs, } - if tools: + if tools := kwargs.get("tools"): params["tools"] = tools return params