|
1 | 1 | import sentry_sdk
|
2 | 2 | from sentry_sdk.ai.utils import get_start_span_function, set_data_normalized
|
3 | 3 | from sentry_sdk.consts import OP, SPANDATA
|
4 |
| -from sentry_sdk.scope import should_send_default_pii |
5 | 4 |
|
6 | 5 | from ..consts import SPAN_ORIGIN
|
7 |
| -from ..utils import _set_agent_data, _set_model_data |
| 6 | +from ..utils import _set_agent_data, _set_model_data, _should_send_prompts |
8 | 7 |
|
9 | 8 | from typing import TYPE_CHECKING
|
10 | 9 |
|
@@ -65,8 +64,8 @@ def invoke_agent_span(user_prompt, agent, model, model_settings):
|
65 | 64 | # If we can't extract tools, just skip it
|
66 | 65 | pass
|
67 | 66 |
|
68 |
| - # Add user prompt and system prompts if available and PII is allowed |
69 |
| - if should_send_default_pii(): |
| 67 | + # Add user prompt and system prompts if available and prompts are enabled |
| 68 | + if _should_send_prompts(): |
70 | 69 | messages = []
|
71 | 70 |
|
72 | 71 | # Add system prompts (both instructions and system_prompt)
|
@@ -135,7 +134,7 @@ def invoke_agent_span(user_prompt, agent, model, model_settings):
|
135 | 134 | def update_invoke_agent_span(span, output):
|
136 | 135 | # type: (sentry_sdk.tracing.Span, Any) -> None
|
137 | 136 | """Update and close the invoke agent span."""
|
138 |
| - if span and should_send_default_pii() and output: |
| 137 | + if span and _should_send_prompts() and output: |
139 | 138 | output_text = str(output) if not isinstance(output, str) else output
|
140 | 139 | set_data_normalized(
|
141 | 140 | span, SPANDATA.GEN_AI_RESPONSE_TEXT, output_text, unpack=False
|
|
0 commit comments