From 335715111d7f2ae04b52e88a02f911a89d9db62f Mon Sep 17 00:00:00 2001 From: Zishan Date: Wed, 26 Feb 2025 16:22:00 +0100 Subject: [PATCH] fix anthropic test --- tests/anthropic/test_anthropic_with_tool_call.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/anthropic/test_anthropic_with_tool_call.py b/tests/anthropic/test_anthropic_with_tool_call.py index 84ba9b8..36f1982 100644 --- a/tests/anthropic/test_anthropic_with_tool_call.py +++ b/tests/anthropic/test_anthropic_with_tool_call.py @@ -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"