fix anthropic test

This commit is contained in:
Zishan authored and Hemang Sarkar committed 2025-02-27 10:30:33 +01:00
1 parent 1795fd4a23
commit 79c934ef45
1 file changed
+3 -1
@@ -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"