Skip to content

Commit 72d4b5a

Browse files
committed
Change prompts to be excluded by default
1 parent 56d2679 commit 72d4b5a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

sentry_sdk/integrations/openai.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ def count_tokens(s):
5050
class OpenAIIntegration(Integration):
5151
identifier = "openai"
5252

53-
def __init__(self, exclude_prompts=False):
53+
def __init__(self, include_prompts=False):
5454
# type: (OpenAIIntegration, bool) -> None
55-
self.exclude_prompts = exclude_prompts
55+
self.include_prompts = include_prompts
5656

5757
@staticmethod
5858
def setup_once():
@@ -161,13 +161,13 @@ def new_chat_completion(*args, **kwargs):
161161
raise e from None
162162

163163
with capture_internal_exceptions():
164-
if _should_send_default_pii() or not integration.exclude_prompts:
164+
if _should_send_default_pii() or integration.include_prompts:
165165
span.set_data("ai.input_messages", messages)
166166
span.set_data("ai.model_id", model)
167167
span.set_data("ai.streaming", streaming)
168168

169169
if hasattr(res, "choices"):
170-
if _should_send_default_pii() or not integration.exclude_prompts:
170+
if _should_send_default_pii() or integration.include_prompts:
171171
span.set_data(
172172
"ai.responses", list(map(lambda x: x.message, res.choices))
173173
)
@@ -200,7 +200,7 @@ def new_iterator():
200200
)
201201
if (
202202
_should_send_default_pii()
203-
or not integration.exclude_prompts
203+
or integration.include_prompts
204204
):
205205
span.set_data("ai.responses", all_responses)
206206
_calculate_chat_completion_usage(
@@ -237,7 +237,7 @@ def new_embeddings_create(*args, **kwargs):
237237
description="OpenAI Embedding Creation",
238238
) as span:
239239
if "input" in kwargs and (
240-
_should_send_default_pii() or not integration.exclude_prompts
240+
_should_send_default_pii() or integration.include_prompts
241241
):
242242
if isinstance(kwargs["input"], str):
243243
span.set_data("ai.input_messages", [kwargs["input"]])

0 commit comments

Comments
 (0)