|
for content in update.contents: |
Error thrown on executing the AG_UI Chat client -
Traceback (most recent call last):
File "...\AG_UI_ChatClient.py", line 6, in
from agent_framework import Agent, ToolCallContent, ToolResultContent
ImportError: cannot import name 'ToolCallContent' from 'agent_framework' (...\Lib\site-packages\agent_framework_init_.py)
Proposed changes that are working -
............
Create AG-UI chat client
chat_client = AGUIChatClient(**endpoint**=server_url)
..........
Display tool calls and results
for content in (update.contents or []):
content_type = getattr(content, "type", "")
if content_type == "function_call":
tool_name = getattr(content, "name", None) or "unknown"
print(f"\n\033[95m[Calling tool: {tool_name}]\033[0m")
elif content_type in {"function_result", "tool_result"}:
result = getattr(content, "result", None)
if result is None:
result = getattr(content, "tool_result", None)
result_text = result if isinstance(result, str) else str(result)
print(f"\033[94m[Tool result: {result_text}]\033[0m")
semantic-kernel-docs/agent-framework/integrations/ag-ui/backend-tool-rendering.md
Line 549 in cd35ecd
Error thrown on executing the AG_UI Chat client -
Traceback (most recent call last):
File "...\AG_UI_ChatClient.py", line 6, in
from agent_framework import Agent, ToolCallContent, ToolResultContent
ImportError: cannot import name 'ToolCallContent' from 'agent_framework' (...\Lib\site-packages\agent_framework_init_.py)
Proposed changes that are working -
............
Create AG-UI chat client
..........
Display tool calls and results