-
Notifications
You must be signed in to change notification settings - Fork 578
feat(gen_ai): add function set_conversation_id and managing functions on the Scope and apply it on the Span on .finish()
#5362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
91776d8
7bd8455
51f9467
30f025c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -697,3 +697,11 @@ def truncate_and_annotate_messages( | |
| scope._gen_ai_original_message_count[span.span_id] = len(messages) | ||
|
|
||
| return truncated_messages | ||
|
|
||
|
|
||
| def set_conversation_id(conversation_id: str) -> None: | ||
| """ | ||
| Set the conversation_id in the scope. | ||
| """ | ||
| scope = sentry_sdk.get_current_scope() | ||
| scope.set_conversation_id(conversation_id) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unused function added to codebaseLow Severity The |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Utility function not exported from ai module
Low Severity
The new
set_conversation_idfunction is added tosentry_sdk/ai/utils.pybut is not exported fromsentry_sdk/ai/__init__.py. Users would need to use the verbose import pathfrom sentry_sdk.ai.utils import set_conversation_idrather thanfrom sentry_sdk.ai import set_conversation_id. This is inconsistent with other functions in the same file that are exported (likeset_data_normalized,normalize_message_role, etc.).