Description
What happened?
The ollama_chat_client.py sample passes tools as a direct keyword argument to OllamaChatClient.get_response(), but the method doesn't accept tools directly. It should be passed inside the options dict.
What did you expect to happen?
The sample should run successfully and return the current time using tool calling.
Steps to reproduce the issue
- Set
OLLAMA_MODEL=llama3.2
- Run:
uv run python/samples/02-agents/providers/ollama/ollama_chat_client.py
- See
TypeError
Code Sample
Current broken code (lines 43 and 48 in ollama_chat_client.py):
# Non-streaming (line 48):
response = await client.get_response(messages, tools=get_time)
# Streaming (line 43):
async for chunk in client.get_response(messages, tools=get_time, stream=True):
Should be:
# Non-streaming:
response = await client.get_response(messages, options={"tools": get_time})
# Streaming:
async for chunk in client.get_response(messages, options={"tools": get_time}, stream=True):
Error Messages / Stack Traces
TypeError: FunctionInvocationLayer.get_response() got an unexpected keyword argument 'tools'
Affected file
python/samples/02-agents/providers/ollama/ollama_chat_client.py
Environment
- agent-framework version: latest
- Ollama model: llama3.2
- OS: Linux
Code Sample
from agent_framework import Message, tool
from agent_framework.ollama import OllamaChatClient
@tool
def get_time():
"""Get the current time."""
from datetime import datetime
return f"The current time is {datetime.now().strftime('%I:%M %p')}."
async def main():
client = OllamaChatClient()
messages = [Message(role="user", contents=["What time is it? Use a tool call"])]
# This raises TypeError:
response = await client.get_response(messages, tools=get_time)
# Should be:
# response = await client.get_response(messages, options={"tools": get_time})
Error Messages / Stack Traces
Package Versions
agent-framework version: 1.8.0 agent-framework-ollama version: 1.0.0b260521 - Python version: 3.14 - Ollama model: llama3.2 - OS: Linux
Python Version
3.14
Additional Context
No response
Description
What happened?
The
ollama_chat_client.pysample passestoolsas a direct keyword argument toOllamaChatClient.get_response(), but the method doesn't accepttoolsdirectly. It should be passed inside theoptionsdict.What did you expect to happen?
The sample should run successfully and return the current time using tool calling.
Steps to reproduce the issue
OLLAMA_MODEL=llama3.2uv run python/samples/02-agents/providers/ollama/ollama_chat_client.pyTypeErrorCode Sample
Current broken code (lines 43 and 48 in
ollama_chat_client.py):Should be:
Error Messages / Stack Traces
Affected file
python/samples/02-agents/providers/ollama/ollama_chat_client.pyEnvironment
Code Sample
Error Messages / Stack Traces
Package Versions
agent-framework version: 1.8.0 agent-framework-ollama version: 1.0.0b260521 - Python version: 3.14 - Ollama model: llama3.2 - OS: Linux
Python Version
3.14
Additional Context
No response