From 7710b406774c825930a52b7920b4fd32229f9dae Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Fri, 13 Mar 2026 16:16:32 +0100 Subject: [PATCH 1/2] test(anthropic): Check system and response ID attributes on spans created by stream() --- tests/integrations/anthropic/test_anthropic.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/integrations/anthropic/test_anthropic.py b/tests/integrations/anthropic/test_anthropic.py index 717e99055d..55d4e21271 100644 --- a/tests/integrations/anthropic/test_anthropic.py +++ b/tests/integrations/anthropic/test_anthropic.py @@ -419,6 +419,7 @@ def test_stream_messages( assert span["op"] == OP.GEN_AI_CHAT assert span["description"] == "chat model" + assert span["data"][SPANDATA.GEN_AI_SYSTEM] == "anthropic" assert span["data"][SPANDATA.GEN_AI_OPERATION_NAME] == "chat" assert span["data"][SPANDATA.GEN_AI_REQUEST_MODEL] == "model" @@ -437,6 +438,7 @@ def test_stream_messages( assert span["data"][SPANDATA.GEN_AI_USAGE_OUTPUT_TOKENS] == 10 assert span["data"][SPANDATA.GEN_AI_USAGE_TOTAL_TOKENS] == 20 assert span["data"][SPANDATA.GEN_AI_RESPONSE_STREAMING] is True + assert span["data"][SPANDATA.GEN_AI_RESPONSE_ID] == "msg_01XFDUDYJgAACzvnptvVoYEL" @pytest.mark.asyncio @@ -658,6 +660,7 @@ async def test_stream_message_async( assert span["op"] == OP.GEN_AI_CHAT assert span["description"] == "chat model" + assert span["data"][SPANDATA.GEN_AI_SYSTEM] == "anthropic" assert span["data"][SPANDATA.GEN_AI_OPERATION_NAME] == "chat" assert span["data"][SPANDATA.GEN_AI_REQUEST_MODEL] == "model" @@ -676,6 +679,7 @@ async def test_stream_message_async( assert span["data"][SPANDATA.GEN_AI_USAGE_OUTPUT_TOKENS] == 10 assert span["data"][SPANDATA.GEN_AI_USAGE_TOTAL_TOKENS] == 20 assert span["data"][SPANDATA.GEN_AI_RESPONSE_STREAMING] is True + assert span["data"][SPANDATA.GEN_AI_RESPONSE_ID] == "msg_01XFDUDYJgAACzvnptvVoYEL" @pytest.mark.skipif( From ec1c83fe9c93fbd6238a4c0a66c90e20bdd73e52 Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Fri, 13 Mar 2026 16:48:12 +0100 Subject: [PATCH 2/2] add system check to more tests --- tests/integrations/anthropic/test_anthropic.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/integrations/anthropic/test_anthropic.py b/tests/integrations/anthropic/test_anthropic.py index 55d4e21271..3a854e3a4e 100644 --- a/tests/integrations/anthropic/test_anthropic.py +++ b/tests/integrations/anthropic/test_anthropic.py @@ -962,6 +962,7 @@ def test_stream_messages_with_input_json_delta( assert span["op"] == OP.GEN_AI_CHAT assert span["description"] == "chat model" + assert span["data"][SPANDATA.GEN_AI_SYSTEM] == "anthropic" assert span["data"][SPANDATA.GEN_AI_OPERATION_NAME] == "chat" assert span["data"][SPANDATA.GEN_AI_REQUEST_MODEL] == "model" @@ -1279,6 +1280,7 @@ async def test_stream_message_with_input_json_delta_async( assert span["op"] == OP.GEN_AI_CHAT assert span["description"] == "chat model" + assert span["data"][SPANDATA.GEN_AI_SYSTEM] == "anthropic" assert span["data"][SPANDATA.GEN_AI_OPERATION_NAME] == "chat" assert span["data"][SPANDATA.GEN_AI_REQUEST_MODEL] == "model" @@ -2078,6 +2080,7 @@ def test_stream_messages_with_system_prompt( assert span["op"] == OP.GEN_AI_CHAT assert span["description"] == "chat model" + assert span["data"][SPANDATA.GEN_AI_SYSTEM] == "anthropic" assert span["data"][SPANDATA.GEN_AI_OPERATION_NAME] == "chat" assert span["data"][SPANDATA.GEN_AI_REQUEST_MODEL] == "model" @@ -2209,6 +2212,7 @@ async def test_stream_message_with_system_prompt_async( assert span["op"] == OP.GEN_AI_CHAT assert span["description"] == "chat model" + assert span["data"][SPANDATA.GEN_AI_SYSTEM] == "anthropic" assert span["data"][SPANDATA.GEN_AI_OPERATION_NAME] == "chat" assert span["data"][SPANDATA.GEN_AI_REQUEST_MODEL] == "model"