Skip to content

Commit 6dac848

Browse files
use should_truncate_gen_ai_input
1 parent bdf8ded commit 6dac848

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

  • sentry_sdk/integrations/google_genai

sentry_sdk/integrations/google_genai/utils.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@
2929
from sentry_sdk.consts import OP, SPANDATA
3030
from sentry_sdk.scope import should_send_default_pii
3131
from sentry_sdk.traces import StreamedSpan
32-
from sentry_sdk.tracing_utils import has_span_streaming_enabled
32+
from sentry_sdk.tracing_utils import (
33+
has_span_streaming_enabled,
34+
should_truncate_gen_ai_input,
35+
)
3336
from sentry_sdk.utils import (
3437
capture_internal_exceptions,
3538
event_from_exception,
@@ -921,9 +924,9 @@ def set_span_data_for_request(
921924
client = sentry_sdk.get_client()
922925
scope = sentry_sdk.get_current_scope()
923926
messages_data = (
924-
normalized_messages
925-
if client.options.get("stream_gen_ai_spans", False)
926-
else truncate_and_annotate_messages(normalized_messages, span, scope)
927+
truncate_and_annotate_messages(normalized_messages, span, scope)
928+
if should_truncate_gen_ai_input(client.options)
929+
else normalized_messages
927930
)
928931
if messages_data is not None:
929932
set_data_normalized(

0 commit comments

Comments
 (0)