@@ -427,7 +427,6 @@ def get_weather(location: str) -> str:
427427 tools_data_str = invoke_span ["attributes" ][
428428 SPANDATA .GEN_AI_REQUEST_AVAILABLE_TOOLS
429429 ]
430-
431430 # Parse the JSON string to verify content
432431 tools_data = json .loads (tools_data_str )
433432 assert len (tools_data ) == 2
@@ -452,7 +451,6 @@ def get_weather(location: str) -> str:
452451
453452 # Check that tools are recorded (data is serialized as a string)
454453 tools_data_str = invoke_span ["data" ][SPANDATA .GEN_AI_REQUEST_AVAILABLE_TOOLS ]
455-
456454 # Parse the JSON string to verify content
457455 tools_data = json .loads (tools_data_str )
458456 assert len (tools_data ) == 2
@@ -701,14 +699,10 @@ def test_streaming_generate_content(
701699 # Verify accumulated response text (all chunks combined)
702700 expected_full_text = "Hello! How can I help you today?"
703701 # Response text is stored as a JSON string
704- if stream_gen_ai_spans :
705- chat_response_text = json .loads (
706- chat_span ["attributes" ][SPANDATA .GEN_AI_RESPONSE_TEXT ]
707- )
708- else :
709- chat_response_text = json .loads (
710- chat_span ["data" ][SPANDATA .GEN_AI_RESPONSE_TEXT ]
711- )
702+ chat_response_text = json .loads (
703+ chat_span ["attributes" ][SPANDATA .GEN_AI_RESPONSE_TEXT ]
704+ )
705+
712706 assert chat_response_text == [expected_full_text ]
713707
714708 # Verify finish reasons (only the final chunk has a finish reason)
@@ -762,14 +756,9 @@ def test_streaming_generate_content(
762756 # Verify accumulated response text (all chunks combined)
763757 expected_full_text = "Hello! How can I help you today?"
764758 # Response text is stored as a JSON string
765- if stream_gen_ai_spans :
766- chat_response_text = json .loads (
767- chat_span ["attributes" ][SPANDATA .GEN_AI_RESPONSE_TEXT ]
768- )
769- else :
770- chat_response_text = json .loads (
771- chat_span ["data" ][SPANDATA .GEN_AI_RESPONSE_TEXT ]
772- )
759+ chat_response_text = json .loads (
760+ chat_span ["data" ][SPANDATA .GEN_AI_RESPONSE_TEXT ]
761+ )
773762 assert chat_response_text == [expected_full_text ]
774763
775764 # Verify finish reasons (only the final chunk has a finish reason)
@@ -1592,7 +1581,6 @@ def test_embed_content(
15921581 (event ,) = events
15931582
15941583 assert event ["type" ] == "transaction"
1595-
15961584 assert event ["transaction" ] == "google_genai_embeddings"
15971585
15981586 # Should have 1 span for embeddings
@@ -1697,7 +1685,6 @@ def test_embed_content_string_input(
16971685
16981686 # Check that single string is handled correctly
16991687 input_texts = json .loads (embed_span ["data" ][SPANDATA .GEN_AI_EMBEDDINGS_INPUT ])
1700-
17011688 assert input_texts == ["Single text input" ]
17021689 # Should use token_count from statistics (5), not billable_character_count (10)
17031690 # Note: Only available in newer versions with ContentEmbeddingStatistics
@@ -2064,7 +2051,6 @@ async def test_async_embed_content_string_input(
20642051 input_texts = json .loads (
20652052 embed_span ["attributes" ][SPANDATA .GEN_AI_EMBEDDINGS_INPUT ]
20662053 )
2067-
20682054 assert input_texts == ["Single text input" ]
20692055 # Should use token_count from statistics (5), not billable_character_count (10)
20702056 # Note: Only available in newer versions with ContentEmbeddingStatistics
@@ -2088,7 +2074,6 @@ async def test_async_embed_content_string_input(
20882074
20892075 # Check that single string is handled correctly
20902076 input_texts = json .loads (embed_span ["data" ][SPANDATA .GEN_AI_EMBEDDINGS_INPUT ])
2091-
20922077 assert input_texts == ["Single text input" ]
20932078 # Should use token_count from statistics (5), not billable_character_count (10)
20942079 # Note: Only available in newer versions with ContentEmbeddingStatistics
0 commit comments