From df0bd4da824d12eaa6391e3a59cc5310d163f057 Mon Sep 17 00:00:00 2001 From: Giles Odigwe <79032838+giles17@users.noreply.github.com> Date: Sun, 14 Jun 2026 23:52:14 -0700 Subject: [PATCH] Python: Fix ollama_chat_client.py sample: pass tools via options dict (#6480) * Fix ollama_chat_client.py sample: pass tools via options dict The sample was passing tools as a direct keyword argument to get_response(), which caused a TypeError. The tools parameter must be passed inside the options dict per the SupportsChatGetResponse protocol. Fixes #6411 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Wrap tools in a list as expected by OllamaChatClient _prepare_tools_for_ollama iterates the tools value, so it must be a list rather than a bare FunctionTool instance. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../samples/02-agents/providers/ollama/ollama_chat_client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/samples/02-agents/providers/ollama/ollama_chat_client.py b/python/samples/02-agents/providers/ollama/ollama_chat_client.py index adf2d3818e..95e6a5f35a 100644 --- a/python/samples/02-agents/providers/ollama/ollama_chat_client.py +++ b/python/samples/02-agents/providers/ollama/ollama_chat_client.py @@ -40,12 +40,12 @@ async def main() -> None: print(f"User: {message}") if stream: print("Assistant: ", end="") - async for chunk in client.get_response(messages, tools=get_time, stream=True): + async for chunk in client.get_response(messages, options={"tools": [get_time]}, stream=True): if str(chunk): print(str(chunk), end="") print("") else: - response = await client.get_response(messages, tools=get_time) + response = await client.get_response(messages, options={"tools": [get_time]}) print(f"Assistant: {response}")