From 9a07d517480d9c6310a06a9b7d5572eaef44776e Mon Sep 17 00:00:00 2001 From: Giles Odigwe Date: Thu, 11 Jun 2026 10:24:39 -0700 Subject: [PATCH 1/2] 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> --- .../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 adf2d3818e3..386506f3ce4 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}") From 33ea96b78f1951f6a351a5a35961d9f2a009abc2 Mon Sep 17 00:00:00 2001 From: Giles Odigwe Date: Thu, 11 Jun 2026 10:38:27 -0700 Subject: [PATCH 2/2] 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> --- .../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 386506f3ce4..95e6a5f35a2 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, options={"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, options={"tools": get_time}) + response = await client.get_response(messages, options={"tools": [get_time]}) print(f"Assistant: {response}")