Skip to content

Commit c5cd959

Browse files
.
1 parent 005eb66 commit c5cd959

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

sentry_sdk/integrations/anthropic.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,7 @@ async def __anext__(self: "AsyncStream") -> "RawMessageStreamEvent":
962962
self._usage,
963963
self._content_blocks,
964964
self._response_id,
965+
self._finish_reason,
965966
)
966967
del self._span
967968
reraise(*exc_info)
@@ -994,6 +995,7 @@ async def close(self: "Stream") -> None:
994995
self._usage,
995996
self._content_blocks,
996997
self._response_id,
998+
self._finish_reason,
997999
)
9981000
del self._span
9991001

tests/integrations/anthropic/test_anthropic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,6 +1083,7 @@ async def test_streaming_create_message_async_next_consumption(
10831083
assert span["data"][SPANDATA.GEN_AI_USAGE_TOTAL_TOKENS] == 20
10841084
assert span["data"][SPANDATA.GEN_AI_RESPONSE_STREAMING] is True
10851085
assert span["data"][SPANDATA.GEN_AI_RESPONSE_ID] == "msg_01XFDUDYJgAACzvnptvVoYEL"
1086+
assert span["data"][SPANDATA.GEN_AI_RESPONSE_FINISH_REASONS] == ["max_tokens"]
10861087

10871088

10881089
@pytest.mark.asyncio
@@ -1192,7 +1193,6 @@ async def test_streaming_create_message_async_iterator_methods(
11921193
assert span["data"][SPANDATA.GEN_AI_USAGE_TOTAL_TOKENS] == 30
11931194
assert span["data"][SPANDATA.GEN_AI_RESPONSE_STREAMING] is True
11941195
assert span["data"][SPANDATA.GEN_AI_RESPONSE_ID] == "msg_01XFDUDYJgAACzvnptvVoYEL"
1195-
assert span["data"][SPANDATA.GEN_AI_RESPONSE_FINISH_REASONS] == ["max_tokens"]
11961196

11971197

11981198
@pytest.mark.asyncio
@@ -1418,6 +1418,7 @@ async def test_stream_messages_async_next_consumption(
14181418
assert span["data"][SPANDATA.GEN_AI_USAGE_TOTAL_TOKENS] == 20
14191419
assert span["data"][SPANDATA.GEN_AI_RESPONSE_STREAMING] is True
14201420
assert span["data"][SPANDATA.GEN_AI_RESPONSE_ID] == "msg_01XFDUDYJgAACzvnptvVoYEL"
1421+
assert span["data"][SPANDATA.GEN_AI_RESPONSE_FINISH_REASONS] == ["max_tokens"]
14211422

14221423

14231424
@pytest.mark.asyncio
@@ -1533,7 +1534,6 @@ async def test_stream_messages_async_iterator_methods(
15331534
assert span["data"][SPANDATA.GEN_AI_USAGE_TOTAL_TOKENS] == 30
15341535
assert span["data"][SPANDATA.GEN_AI_RESPONSE_STREAMING] is True
15351536
assert span["data"][SPANDATA.GEN_AI_RESPONSE_ID] == "msg_01XFDUDYJgAACzvnptvVoYEL"
1536-
assert span["data"][SPANDATA.GEN_AI_RESPONSE_FINISH_REASONS] == ["max_tokens"]
15371537

15381538

15391539
@pytest.mark.skipif(

0 commit comments

Comments
 (0)