@@ -96,7 +96,12 @@ def mock_anthropic_response_with_tool_use():
9696 role = "assistant" ,
9797 content = [
9898 {"type" : "text" , "text" : "I'll help you with that." },
99- {"type" : "tool_use" , "id" : "tool_1" , "name" : "get_weather" , "input" : {"location" : "New York" }}
99+ {
100+ "type" : "tool_use" ,
101+ "id" : "tool_1" ,
102+ "name" : "get_weather" ,
103+ "input" : {"location" : "New York" },
104+ },
100105 ],
101106 model = "claude-3-opus-20240229" ,
102107 usage = Usage (
@@ -479,7 +484,9 @@ def test_tool_use_response(mock_client, mock_anthropic_response_with_tool_use):
479484 assert call_args ["event" ] == "$ai_generation"
480485 assert props ["$ai_provider" ] == "anthropic"
481486 assert props ["$ai_model" ] == "claude-3-opus-20240229"
482- assert props ["$ai_input" ] == [{"role" : "user" , "content" : "What's the weather like?" }]
487+ assert props ["$ai_input" ] == [
488+ {"role" : "user" , "content" : "What's the weather like?" }
489+ ]
483490 # Should only include text content, not tool_use content
484491 assert props ["$ai_output_choices" ] == [
485492 {"role" : "assistant" , "content" : "I'll help you with that." }
@@ -490,4 +497,11 @@ def test_tool_use_response(mock_client, mock_anthropic_response_with_tool_use):
490497 assert props ["foo" ] == "bar"
491498 assert isinstance (props ["$ai_latency" ], float )
492499 # Verify that tools are captured separately
493- assert props ["$ai_tools" ] == [{"type" : "tool_use" , "id" : "tool_1" , "name" : "get_weather" , "input" : {"location" : "New York" }}]
500+ assert props ["$ai_tools" ] == [
501+ {
502+ "type" : "tool_use" ,
503+ "id" : "tool_1" ,
504+ "name" : "get_weather" ,
505+ "input" : {"location" : "New York" },
506+ }
507+ ]
0 commit comments