Skip to content

Commit

Permalink
add back anthropic change
Browse files Browse the repository at this point in the history
  • Loading branch information
szokeasaurusrex committed Sep 23, 2024
1 parent 9eb47af commit 9a5beec
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions sentry_sdk/integrations/anthropic.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from sentry_sdk.scope import should_send_default_pii
from sentry_sdk.utils import (
capture_internal_exceptions,
ensure_integration_enabled,
event_from_exception,
package_version,
)
Expand Down Expand Up @@ -78,10 +77,11 @@ def _calculate_token_usage(result, span):
def _wrap_message_create(f):
# type: (Any) -> Any
@wraps(f)
@ensure_integration_enabled(AnthropicIntegration, f)
def _sentry_patched_create(*args, **kwargs):
# type: (*Any, **Any) -> Any
if "messages" not in kwargs:
integration = sentry_sdk.get_client().get_integration(AnthropicIntegration)

if integration is None or "messages" not in kwargs:
return f(*args, **kwargs)

try:
Expand All @@ -106,8 +106,6 @@ def _sentry_patched_create(*args, **kwargs):
span.__exit__(None, None, None)
raise exc from None

integration = sentry_sdk.get_client().get_integration(AnthropicIntegration)

with capture_internal_exceptions():
span.set_data(SPANDATA.AI_MODEL_ID, model)
span.set_data(SPANDATA.AI_STREAMING, False)
Expand Down

0 comments on commit 9a5beec

Please sign in to comment.