@@ -30,8 +30,8 @@ def create_polygraf_mock_response(
3030 detected_entities = []
3131
3232 entity_patterns = {
33- "NAME " : ["John" ],
34- "EMAIL_ADDRESS " : ["test@gmail.com" ],
33+ "Person " : ["John" ],
34+ "Email " : ["test@gmail.com" ],
3535 }
3636
3737 for entity_type , patterns in entity_patterns .items ():
@@ -148,8 +148,8 @@ def test_polygraf_pii_detection_input():
148148 server_endpoint: http://localhost:8000/v1/pii/text-detect
149149 input:
150150 entities:
151- - EMAIL_ADDRESS
152- - NAME
151+ - Email
152+ - Person
153153 input:
154154 flows:
155155 - polygraf detect pii on input
@@ -177,11 +177,11 @@ def test_polygraf_pii_detection_input():
177177
178178 chat .app .register_action (retrieve_relevant_chunks , "retrieve_relevant_chunks" )
179179 chat .app .register_action (
180- create_mock_polygraf_detect_pii (["EMAIL_ADDRESS " , "NAME " ]),
180+ create_mock_polygraf_detect_pii (["Email " , "Person " ]),
181181 "polygraf_detect_pii" ,
182182 )
183183 chat .app .register_action (
184- create_mock_polygraf_mask_pii (["EMAIL_ADDRESS " , "NAME " ]),
184+ create_mock_polygraf_mask_pii (["Email " , "Person " ]),
185185 "polygraf_mask_pii" ,
186186 )
187187
@@ -200,8 +200,8 @@ def test_polygraf_pii_detection_output():
200200 server_endpoint: http://localhost:8000/v1/pii/text-detect
201201 output:
202202 entities:
203- - EMAIL_ADDRESS
204- - NAME
203+ - Email
204+ - Person
205205 output:
206206 flows:
207207 - polygraf detect pii on output
@@ -229,11 +229,11 @@ def test_polygraf_pii_detection_output():
229229
230230 chat .app .register_action (retrieve_relevant_chunks , "retrieve_relevant_chunks" )
231231 chat .app .register_action (
232- create_mock_polygraf_detect_pii (["EMAIL_ADDRESS " , "NAME " ]),
232+ create_mock_polygraf_detect_pii (["Email " , "Person " ]),
233233 "polygraf_detect_pii" ,
234234 )
235235 chat .app .register_action (
236- create_mock_polygraf_mask_pii (["EMAIL_ADDRESS " , "NAME " ]),
236+ create_mock_polygraf_mask_pii (["Email " , "Person " ]),
237237 "polygraf_mask_pii" ,
238238 )
239239
@@ -252,8 +252,8 @@ def test_polygraf_pii_detection_retrieval_with_no_pii():
252252 server_endpoint: http://localhost:8000/v1/pii/text-detect
253253 retrieval:
254254 entities:
255- - EMAIL_ADDRESS
256- - NAME
255+ - Email
256+ - Person
257257 retrieval:
258258 flows:
259259 - polygraf detect pii on retrieval
@@ -281,11 +281,11 @@ def test_polygraf_pii_detection_retrieval_with_no_pii():
281281
282282 chat .app .register_action (retrieve_relevant_chunks , "retrieve_relevant_chunks" )
283283 chat .app .register_action (
284- create_mock_polygraf_detect_pii (["EMAIL_ADDRESS " , "NAME " ]),
284+ create_mock_polygraf_detect_pii (["Email " , "Person " ]),
285285 "polygraf_detect_pii" ,
286286 )
287287 chat .app .register_action (
288- create_mock_polygraf_mask_pii (["EMAIL_ADDRESS " , "NAME " ]),
288+ create_mock_polygraf_mask_pii (["Email " , "Person " ]),
289289 "polygraf_mask_pii" ,
290290 )
291291
@@ -304,8 +304,8 @@ def test_polygraf_pii_masking_on_output():
304304 server_endpoint: http://localhost:8000/v1/pii/text-detect
305305 output:
306306 entities:
307- - EMAIL_ADDRESS
308- - NAME
307+ - Email
308+ - Person
309309 output:
310310 flows:
311311 - polygraf mask pii on output
@@ -333,11 +333,11 @@ def test_polygraf_pii_masking_on_output():
333333
334334 chat .app .register_action (retrieve_relevant_chunks , "retrieve_relevant_chunks" )
335335 chat .app .register_action (
336- create_mock_polygraf_detect_pii (["EMAIL_ADDRESS " , "NAME " ]),
336+ create_mock_polygraf_detect_pii (["Email " , "Person " ]),
337337 "polygraf_detect_pii" ,
338338 )
339339 chat .app .register_action (
340- create_mock_polygraf_mask_pii (["EMAIL_ADDRESS " , "NAME " ]),
340+ create_mock_polygraf_mask_pii (["Email " , "Person " ]),
341341 "polygraf_mask_pii" ,
342342 )
343343
@@ -357,8 +357,8 @@ def test_polygraf_pii_masking_on_input():
357357 server_endpoint: http://localhost:8000/v1/pii/text-detect
358358 input:
359359 entities:
360- - EMAIL_ADDRESS
361- - NAME
360+ - Email
361+ - Person
362362 input:
363363 flows:
364364 - polygraf mask pii on input
@@ -396,11 +396,11 @@ def check_user_message(user_message: str):
396396 chat .app .register_action (retrieve_relevant_chunks , "retrieve_relevant_chunks" )
397397 chat .app .register_action (check_user_message , "check_user_message" )
398398 chat .app .register_action (
399- create_mock_polygraf_detect_pii (["EMAIL_ADDRESS " , "NAME " ]),
399+ create_mock_polygraf_detect_pii (["Email " , "Person " ]),
400400 "polygraf_detect_pii" ,
401401 )
402402 chat .app .register_action (
403- create_mock_polygraf_mask_pii (["EMAIL_ADDRESS " , "NAME " ]),
403+ create_mock_polygraf_mask_pii (["Email " , "Person " ]),
404404 "polygraf_mask_pii" ,
405405 )
406406
@@ -418,8 +418,8 @@ def test_polygraf_pii_masking_on_retrieval():
418418 server_endpoint: http://localhost:8000/v1/pii/text-detect
419419 retrieval:
420420 entities:
421- - EMAIL_ADDRESS
422- - NAME
421+ - Email
422+ - Person
423423 retrieval:
424424 flows:
425425 - polygraf mask pii on retrieval
@@ -452,7 +452,7 @@ def test_polygraf_pii_masking_on_retrieval():
452452 @action ()
453453 def check_relevant_chunks (relevant_chunks : str ):
454454 """Check if the relevant chunks have PII masked."""
455- assert "test@gmail.com" not in relevant_chunks or "<EMAIL_ADDRESS >" in relevant_chunks
455+ assert "test@gmail.com" not in relevant_chunks or "<Email >" in relevant_chunks
456456
457457 @action ()
458458 def retrieve_relevant_chunk_for_masking ():
@@ -465,11 +465,11 @@ def retrieve_relevant_chunk_for_masking():
465465 chat .app .register_action (retrieve_relevant_chunk_for_masking , "retrieve_relevant_chunks" )
466466 chat .app .register_action (check_relevant_chunks )
467467 chat .app .register_action (
468- create_mock_polygraf_detect_pii (["EMAIL_ADDRESS " , "NAME " ]),
468+ create_mock_polygraf_detect_pii (["Email " , "Person " ]),
469469 "polygraf_detect_pii" ,
470470 )
471471 chat .app .register_action (
472- create_mock_polygraf_mask_pii (["EMAIL_ADDRESS " , "NAME " ]),
472+ create_mock_polygraf_mask_pii (["Email " , "Person " ]),
473473 "polygraf_mask_pii" ,
474474 )
475475
0 commit comments