Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions sentry_sdk/ai/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

import sentry_sdk
from sentry_sdk.traces import StreamedSpan
from sentry_sdk.tracing_utils import has_span_streaming_enabled
from sentry_sdk.utils import logger

MAX_GEN_AI_MESSAGE_BYTES = 20_000 # 20KB
Expand Down Expand Up @@ -538,13 +537,7 @@ def normalize_message_roles(messages: "list[dict[str, Any]]") -> "list[dict[str,


def get_start_span_function() -> "Callable[..., Any]":
if has_span_streaming_enabled(sentry_sdk.get_client().options):
return sentry_sdk.traces.start_span
Comment on lines -541 to -542

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we still need this part? Without it we're only using non-streaming APIs in this function

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or are we simply not using the helper in a streaming context anymore?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes the plan is to drop the wrapper in span streaming branches.
And after #6404 is merged it won't be used when span streaming is enabled.


current_span = sentry_sdk.get_current_span()
if isinstance(current_span, StreamedSpan):
# mypy
return sentry_sdk.traces.start_span

transaction_exists = (
current_span is not None and current_span.containing_transaction is not None
Comment thread
alexander-alderman-webb marked this conversation as resolved.
Expand Down
Loading