@@ -50,9 +50,9 @@ def count_tokens(s):
50
50
class OpenAIIntegration (Integration ):
51
51
identifier = "openai"
52
52
53
- def __init__ (self , exclude_prompts = False ):
53
+ def __init__ (self , include_prompts = False ):
54
54
# type: (OpenAIIntegration, bool) -> None
55
- self .exclude_prompts = exclude_prompts
55
+ self .include_prompts = include_prompts
56
56
57
57
@staticmethod
58
58
def setup_once ():
@@ -161,13 +161,13 @@ def new_chat_completion(*args, **kwargs):
161
161
raise e from None
162
162
163
163
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 :
165
165
span .set_data ("ai.input_messages" , messages )
166
166
span .set_data ("ai.model_id" , model )
167
167
span .set_data ("ai.streaming" , streaming )
168
168
169
169
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 :
171
171
span .set_data (
172
172
"ai.responses" , list (map (lambda x : x .message , res .choices ))
173
173
)
@@ -200,7 +200,7 @@ def new_iterator():
200
200
)
201
201
if (
202
202
_should_send_default_pii ()
203
- or not integration .exclude_prompts
203
+ or integration .include_prompts
204
204
):
205
205
span .set_data ("ai.responses" , all_responses )
206
206
_calculate_chat_completion_usage (
@@ -237,7 +237,7 @@ def new_embeddings_create(*args, **kwargs):
237
237
description = "OpenAI Embedding Creation" ,
238
238
) as span :
239
239
if "input" in kwargs and (
240
- _should_send_default_pii () or not integration .exclude_prompts
240
+ _should_send_default_pii () or integration .include_prompts
241
241
):
242
242
if isinstance (kwargs ["input" ], str ):
243
243
span .set_data ("ai.input_messages" , [kwargs ["input" ]])
0 commit comments