1212
1313
1414@pytest .mark .parametrize (
15- "send_default_pii, include_prompts " ,
16- [( True , True ), ( True , False ), ( False , True ), ( False , False ) ],
15+ "send_default_pii" ,
16+ [True , False ],
1717)
1818def test_nonstreaming_chat (
1919 sentry_init ,
2020 capture_items ,
2121 send_default_pii ,
22- include_prompts ,
2322):
2423 sentry_init (
25- integrations = [CohereIntegration (include_prompts = include_prompts )],
24+ integrations = [CohereIntegration ()],
2625 traces_sample_rate = 1.0 ,
2726 send_default_pii = send_default_pii ,
2827 )
@@ -59,7 +58,7 @@ def test_nonstreaming_chat(
5958 assert span ["attributes" ]["sentry.op" ] == "ai.chat_completions.create.cohere"
6059 assert span ["attributes" ][SPANDATA .AI_MODEL_ID ] == "some-model"
6160
62- if send_default_pii and include_prompts :
61+ if send_default_pii :
6362 assert (
6463 '{"role": "system", "content": "some context"}'
6564 in span ["attributes" ][SPANDATA .AI_INPUT_MESSAGES ]
@@ -80,17 +79,16 @@ def test_nonstreaming_chat(
8079
8180# noinspection PyTypeChecker
8281@pytest .mark .parametrize (
83- "send_default_pii, include_prompts " ,
84- [( True , True ), ( True , False ), ( False , True ), ( False , False ) ],
82+ "send_default_pii" ,
83+ [True , False ],
8584)
8685def test_streaming_chat (
8786 sentry_init ,
8887 capture_items ,
8988 send_default_pii ,
90- include_prompts ,
9189):
9290 sentry_init (
93- integrations = [CohereIntegration (include_prompts = include_prompts )],
91+ integrations = [CohereIntegration ()],
9492 traces_sample_rate = 1.0 ,
9593 send_default_pii = send_default_pii ,
9694 )
@@ -142,7 +140,7 @@ def test_streaming_chat(
142140 assert span ["attributes" ]["sentry.op" ] == "ai.chat_completions.create.cohere"
143141 assert span ["attributes" ][SPANDATA .AI_MODEL_ID ] == "some-model"
144142
145- if send_default_pii and include_prompts :
143+ if send_default_pii :
146144 assert (
147145 '{"role": "system", "content": "some context"}'
148146 in span ["attributes" ][SPANDATA .AI_INPUT_MESSAGES ]
@@ -206,17 +204,16 @@ def test_span_status_error(sentry_init, capture_items):
206204
207205
208206@pytest .mark .parametrize (
209- "send_default_pii, include_prompts " ,
210- [( True , True ), ( True , False ), ( False , True ), ( False , False ) ],
207+ "send_default_pii" ,
208+ [True , False ],
211209)
212210def test_embed (
213211 sentry_init ,
214212 capture_items ,
215213 send_default_pii ,
216- include_prompts ,
217214):
218215 sentry_init (
219- integrations = [CohereIntegration (include_prompts = include_prompts )],
216+ integrations = [CohereIntegration ()],
220217 traces_sample_rate = 1.0 ,
221218 send_default_pii = send_default_pii ,
222219 )
@@ -249,7 +246,7 @@ def test_embed(
249246 span = items [0 ].payload
250247
251248 assert span ["attributes" ]["sentry.op" ] == "ai.embeddings.create.cohere"
252- if send_default_pii and include_prompts :
249+ if send_default_pii :
253250 assert "hello" in span ["attributes" ][SPANDATA .AI_INPUT_MESSAGES ]
254251 else :
255252 assert SPANDATA .AI_INPUT_MESSAGES not in span ["attributes" ]
@@ -326,28 +323,25 @@ def test_span_origin_embed(sentry_init, capture_items):
326323 assert span ["attributes" ]["sentry.origin" ] == "auto.ai.cohere"
327324
328325
329- # data_collection config, send_default_pii, include_prompts, expect_inputs, expect_outputs
326+ # data_collection config, send_default_pii, expect_inputs, expect_outputs
330327DATA_COLLECTION_CASES = [
331328 pytest .param (
332329 {"gen_ai" : {"inputs" : True , "outputs" : True }},
333330 False ,
334- False ,
335331 True ,
336332 True ,
337333 id = "gen-ai-inputs-and-outputs-enabled-override-legacy-off" ,
338334 ),
339335 pytest .param (
340336 {"gen_ai" : {"inputs" : False , "outputs" : False }},
341337 True ,
342- True ,
343338 False ,
344339 False ,
345340 id = "gen-ai-inputs-and-outputs-disabled-override-legacy-on" ,
346341 ),
347342 pytest .param (
348343 {"gen_ai" : {"inputs" : True , "outputs" : False }},
349344 False ,
350- False ,
351345 True ,
352346 False ,
353347 id = "gen-ai-inputs-enabled-outputs-disabled" ,
@@ -356,14 +350,12 @@ def test_span_origin_embed(sentry_init, capture_items):
356350 {"gen_ai" : {"inputs" : False , "outputs" : True }},
357351 False ,
358352 False ,
359- False ,
360353 True ,
361354 id = "gen-ai-outputs-enabled-inputs-disabled" ,
362355 ),
363356 pytest .param (
364357 {"gen_ai" : {}},
365358 False ,
366- False ,
367359 True ,
368360 True ,
369361 id = "gen-ai-inputs-and-outputs-omitted-default-to-enabled" ,
@@ -373,13 +365,11 @@ def test_span_origin_embed(sentry_init, capture_items):
373365 True ,
374366 True ,
375367 True ,
376- True ,
377- id = "no-gen-ai-config-legacy-pii-and-include-prompts-enabled" ,
368+ id = "no-gen-ai-config-legacy-pii" ,
378369 ),
379370 pytest .param (
380371 None ,
381372 False ,
382- True ,
383373 False ,
384374 False ,
385375 id = "no-gen-ai-config-legacy-pii-disabled" ,
@@ -391,10 +381,9 @@ def _init_with_data_collection(
391381 sentry_init ,
392382 data_collection ,
393383 send_default_pii ,
394- include_prompts ,
395384):
396385 kwargs = dict (
397- integrations = [CohereIntegration (include_prompts = include_prompts )],
386+ integrations = [CohereIntegration ()],
398387 traces_sample_rate = 1.0 ,
399388 send_default_pii = send_default_pii ,
400389 )
@@ -405,23 +394,21 @@ def _init_with_data_collection(
405394
406395
407396@pytest .mark .parametrize (
408- "data_collection, send_default_pii, include_prompts, expect_inputs, expect_outputs" ,
397+ "data_collection, send_default_pii, expect_inputs, expect_outputs" ,
409398 DATA_COLLECTION_CASES ,
410399)
411400def test_nonstreaming_chat_data_collection (
412401 sentry_init ,
413402 capture_items ,
414403 data_collection ,
415404 send_default_pii ,
416- include_prompts ,
417405 expect_inputs ,
418406 expect_outputs ,
419407):
420408 _init_with_data_collection (
421409 sentry_init ,
422410 data_collection ,
423411 send_default_pii ,
424- include_prompts ,
425412 )
426413
427414 client = Client (api_key = "z" )
@@ -483,23 +470,21 @@ def test_nonstreaming_chat_data_collection(
483470
484471
485472@pytest .mark .parametrize (
486- "data_collection, send_default_pii, include_prompts, expect_inputs, expect_outputs" ,
473+ "data_collection, send_default_pii, expect_inputs, expect_outputs" ,
487474 DATA_COLLECTION_CASES ,
488475)
489476def test_streaming_chat_data_collection (
490477 sentry_init ,
491478 capture_items ,
492479 data_collection ,
493480 send_default_pii ,
494- include_prompts ,
495481 expect_inputs ,
496482 expect_outputs ,
497483):
498484 _init_with_data_collection (
499485 sentry_init ,
500486 data_collection ,
501487 send_default_pii ,
502- include_prompts ,
503488 )
504489
505490 client = Client (api_key = "z" )
@@ -574,23 +559,21 @@ def test_streaming_chat_data_collection(
574559
575560
576561@pytest .mark .parametrize (
577- "data_collection, send_default_pii, include_prompts, expect_inputs, expect_outputs" ,
562+ "data_collection, send_default_pii, expect_inputs, expect_outputs" ,
578563 DATA_COLLECTION_CASES ,
579564)
580565def test_embed_data_collection (
581566 sentry_init ,
582567 capture_items ,
583568 data_collection ,
584569 send_default_pii ,
585- include_prompts ,
586570 expect_inputs ,
587571 expect_outputs ,
588572):
589573 _init_with_data_collection (
590574 sentry_init ,
591575 data_collection ,
592576 send_default_pii ,
593- include_prompts ,
594577 )
595578
596579 client = Client (api_key = "z" )
0 commit comments