Skip to content

Commit bf009ca

Browse files
.
1 parent 032e6a4 commit bf009ca

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

sentry_sdk/integrations/anthropic.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ def _common_set_input_data(
283283
span.set_data(SPANDATA.GEN_AI_OPERATION_NAME, "chat")
284284
if (
285285
messages is not None
286-
and len(messages) > 0
286+
and len(messages) > 0 # type: ignore
287287
and should_send_default_pii()
288288
and integration.include_prompts
289289
):
@@ -357,7 +357,7 @@ def _common_set_input_data(
357357
if top_p is not None and _is_given(top_p):
358358
span.set_data(SPANDATA.GEN_AI_REQUEST_TOP_P, top_p)
359359

360-
if tools is not None and _is_given(tools) and len(tools) > 0:
360+
if tools is not None and _is_given(tools) and len(tools) > 0: # type: ignore
361361
span.set_data(SPANDATA.GEN_AI_REQUEST_AVAILABLE_TOOLS, safe_serialize(tools))
362362

363363

@@ -805,6 +805,9 @@ def _wrap_message_stream_manager_enter(f: "Any") -> "Any":
805805
@wraps(f)
806806
def _sentry_patched_enter(self) -> "MessageStreamManager":
807807
stream_manager = f(self)
808+
if not hasattr(self, "_max_tokens"):
809+
return stream_manager
810+
808811
_sentry_patched_stream_common(
809812
stream_manager=stream_manager,
810813
max_tokens=self._max_tokens,

0 commit comments

Comments
 (0)