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"