You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importboto3importasynciofrombotocore.configimportConfigfromautogen_core.modelsimportModelInfo, ModelFamilyfromautogen_ext.models.semantic_kernelimportSKChatCompletionAdapterfromsemantic_kernelimportKernelfromsemantic_kernel.connectors.ai.bedrockimportBedrockChatCompletion, BedrockChatPromptExecutionSettingsfromsemantic_kernel.memory.null_memoryimportNullMemorymy_config=Config(
region_name='us-east-1',
signature_version='v4',
retries= {
'max_attempts': 10,
'mode': 'standard'
},
)
# Create the custom boto3 clientbedrock_runtime_client=boto3.client(service_name='bedrock-runtime', config=my_config)
bedrock_client=boto3.client("bedrock", config=my_config)
sk_client=BedrockChatCompletion(
model_id='anthropic.claude-3-5-sonnet-20240620-v1:0',
runtime_client=bedrock_runtime_client,
client=bedrock_client,
)
# Configure execution settingssettings=BedrockChatPromptExecutionSettings(
temperature=0.7,
max_tokens=1000,
)
model_info=ModelInfo(vision=False, function_calling=True, json_output=True, family=ModelFamily.UNKNOWN)
model_client=SKChatCompletionAdapter(
sk_client,
kernel=Kernel(memory=NullMemory()),
prompt_settings=settings,
model_info=model_info,
)
fromautogen_agentchat.agentsimportAssistantAgentfromautogen_agentchat.messagesimportTextMessagefromautogen_coreimportCancellationTokenasyncdefget_weather(city: str) ->str:
"""Get the current weather for a given city"""returnf"The weather in {city} is 73 degrees and Sunny."asyncdefmain() ->None:
weather_agent=AssistantAgent(
name="assistant",
model_client=model_client,
tools=[get_weather],
system_message="You are a helpful AI assistant that can provide weather information.",
model_client_stream=True,
)
# print("Registered tools:", [tool.name for tool in weather_agent._tools])stream=weather_agent.on_messages_stream(
[TextMessage(content="Weather in Shanghai", source="user")], CancellationToken()
)
asyncforresponseinstream:
print(response)
asyncio.run(main())
Error
source='assistant' models_usage=None content="Certainly! I'd be happy to" type='ModelClientStreamingChunkEvent'
source='assistant' models_usage=None content=' provide you with the current weather' type='ModelClientStreamingChunkEvent'
source='assistant' models_usage=None content=' information for Shanghai. To get the most' type='ModelClientStreamingChunkEvent'
source='assistant' models_usage=None content=' up-to-date an' type='ModelClientStreamingChunkEvent'
source='assistant' models_usage=None content="d accurate weather data, I'll nee" type='ModelClientStreamingChunkEvent'
source='assistant' models_usage=None content='d to use the weather' type='ModelClientStreamingChunkEvent'
source='assistant' models_usage=None content=' tool. Let me fetch' type='ModelClientStreamingChunkEvent'
source='assistant' models_usage=None content=' that information for you right' type='ModelClientStreamingChunkEvent'
source='assistant' models_usage=None content=' away.' type='ModelClientStreamingChunkEvent'
source='assistant' models_usage=RequestUsage(prompt_tokens=0, completion_tokens=0) content=[FunctionCall(id='tooluse_VN13BhhhTLuwwFxmtQUdqA', arguments='{}', name='autogen-tools_get_weather')] type='ToolCallRequestEvent'
source='assistant' models_usage=None content=[FunctionExecutionResult(content="Error: The tool 'autogen-tools_get_weather' is not available.", call_id='tooluse_VN13BhhhTLuwwFxmtQUdqA')] type='ToolCallExecutionEvent'
Response(chat_message=ToolCallSummaryMessage(source='assistant', models_usage=None, content="**Error: The tool 'autogen-tools_get_weather' is not available.**", type='ToolCallSummaryMessage'), inner_messages=[ToolCallRequestEvent(source='assistant', models_usage=RequestUsage(prompt_tokens=0, completion_tokens=0), content=[FunctionCall(id='tooluse_VN13BhhhTLuwwFxmtQUdqA', arguments='{}', name='autogen-tools_get_weather')], type='ToolCallRequestEvent'), ToolCallExecutionEvent(source='assistant', models_usage=None, content=[FunctionExecutionResult(content="Error: The tool 'autogen-tools_get_weather' is not available.", call_id='tooluse_VN13BhhhTLuwwFxmtQUdqA')], type='ToolCallExecutionEvent')])
The text was updated successfully, but these errors were encountered:
@ekzhu@lspinheiro
Is this released I have folowing
opentelemetry-semantic-conventions 0.51b0
semantic-kernel 1.17.1
semantic-version 2.10.0
autogen-agentchat 0.4.7
autogen-core 0.4.7
autogen-ext 0.4.7
Still getting this error ---------- weather_agent ----------
Error: The tool 'get-weather' is not available.
Discussed in #5420
Originally posted by GxWwT February 7, 2025
Error
The text was updated successfully, but these errors were encountered: