Python: Fixed AutoGen migration and tool samples (#4027)

* Fixed ollama_chat_client sample

* Fixed ollama_chat_multimodal sample

* Fixed function_tool_with_approval_and_sessions sample

* Updated function_tool_with_session_injection sample

* Small clean-up

* Update 01_round_robin_group_chat.py

* Update 02_selector_group_chat.py

* Update 03_swarm.py

* Update 03_assistant_agent_thread_and_stream.py

* Update 04_agent_as_tool.py

* Resolved comments
This commit is contained in:
Dmytro Struk
2026-02-18 15:58:38 +00:00
committed by GitHub
parent f9f630829a
commit f087b864fb
12 changed files with 30 additions and 45 deletions
@@ -3,7 +3,7 @@
import asyncio
from datetime import datetime
from agent_framework import tool
from agent_framework import Message, tool
from agent_framework.ollama import OllamaChatClient
"""
@@ -29,16 +29,17 @@ def get_time():
async def main() -> None:
client = OllamaChatClient()
message = "What time is it? Use a tool call"
messages = [Message(role="user", text=message)]
stream = False
print(f"User: {message}")
if stream:
print("Assistant: ", end="")
async for chunk in client.get_response(message, tools=get_time, stream=True):
async for chunk in client.get_response(messages, tools=get_time, stream=True):
if str(chunk):
print(str(chunk), end="")
print("")
else:
response = await client.get_response(message, tools=get_time)
response = await client.get_response(messages, tools=get_time)
print(f"Assistant: {response}")
@@ -40,7 +40,7 @@ async def test_image() -> None:
],
)
response = await client.get_response(message)
response = await client.get_response([message])
print(f"Image Response: {response}")