Skip to content

Commit db5dbb9

Browse files
.
1 parent 6cdab16 commit db5dbb9

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

sentry_sdk/integrations/anthropic.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -395,12 +395,11 @@ def _set_output_data(
395395
def _patch_streaming_response_iterator(
396396
result: "AsyncStream[RawMessageStreamEvent]",
397397
span: "sentry_sdk.tracing.Span",
398-
):
398+
integration: "AnthropicIntegration",
399+
) -> None:
399400
"""
400401
Responsible for closing the `gen_ai.chat` span and setting attributes acquired during response consumption.
401402
"""
402-
integration = sentry_sdk.get_client().get_integration(AnthropicIntegration)
403-
404403
old_iterator = result._iterator
405404

406405
def new_iterator() -> "Iterator[MessageStreamEvent]":
@@ -513,7 +512,7 @@ def _sentry_patched_create_common(f: "Any", *args: "Any", **kwargs: "Any") -> "A
513512

514513
is_streaming_response = kwargs.get("stream", False)
515514
if is_streaming_response:
516-
_patch_streaming_response_iterator(result, span)
515+
_patch_streaming_response_iterator(result, span, integration)
517516
return result
518517

519518
with capture_internal_exceptions():

0 commit comments

Comments
 (0)