fix anthropic test

This commit is contained in:
Zishan
2025-02-26 16:22:00 +01:00
parent 320c410493
commit 335715111d
@@ -104,6 +104,7 @@ class WeatherAgent:
while True:
json_data = ""
content = []
event = None
with self.client.messages.stream(
tools=[self.get_weather_function],
model="claude-3-5-sonnet-20241022",
@@ -140,7 +141,8 @@ class WeatherAgent:
type="tool_use",
)
)
response_list.append(content)
if content:
response_list.append(content)
if (
isinstance(event, anthropic.types.RawMessageStopEvent)
and event.message.stop_reason == "tool_use"