-
Notifications
You must be signed in to change notification settings - Fork 152
Privacy plugin
Asankhaya Sharma edited this page Jan 9, 2025
·
1 revision
The optillm privacy plugin uses Microsoft's Presidio to mask PII data transparently in requests and responses.
You can use it with any model by prepending the plugin
slug.
E.g. given an input that contains PII data like this:
messages=[
{
"role": "user",
"content": '''Hi, I need to create an employee directory for our small HR team. Here are the details of our new hires:
John Smith - hired as Senior Developer, employee ID AD789, contact: jsmith@acmetech.com, (555) 234-5678
Maria Garcia - hired as Product Manager, employee ID PM456, contact: mgarcia@acmetech.com, (555) 345-6789
Robert Chen - hired as UX Designer, employee ID UX123, contact: rchen@acmetech.com, (555) 456-7890
Could you format this into a nice directory with their contact details and roles?'''}
]
response = client.chat.completions.create(
messages=messages,
temperature=0.2,
)
The plugin will mask the PII data in the request automatically:
Anonymized request: User: Hi, I need to create an employee directory for our small HR team. Here are the details of our new hires:
<PERSON_2> - hired as Senior Developer, employee ID <US_DRIVER_LICENSE_2>, contact: <EMAIL_ADDRESS_2>, <PHONE_NUMBER_2>
<PERSON_1> - hired as Product Manager, employee ID <US_DRIVER_LICENSE_1>, contact: <EMAIL_ADDRESS_1>, <PHONE_NUMBER_1>
<PERSON_0> hired as UX Designer, employee ID <US_DRIVER_LICENSE_0>, contact: <EMAIL_ADDRESS_0>, <PHONE_NUMBER_0>
Could you format this into a nice directory with their contact details and roles?
2025-01-10 06:09:26,433 - INFO - HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK"
response: Sure! Here's a formatted employee directory for your HR team:
So, the response you get from the model will look like:
response: Sure! Here's a formatted employee directory for your HR team:
---
### Employee Directory
| Name | Position | Employee ID | Contact Email | Phone Number |
|---------------|---------------------|---------------------|---------------------|-------------------|
| <PERSON_0> | UX Designer | <US_DRIVER_LICENSE_0>| <EMAIL_ADDRESS_0> | <PHONE_NUMBER_0> |
| <PERSON_1> | Product Manager | <US_DRIVER_LICENSE_1>| <EMAIL_ADDRESS_1> | <PHONE_NUMBER_1> |
| <PERSON_2> | Senior Developer | <US_DRIVER_LICENSE_2>| <EMAIL_ADDRESS_2> | <PHONE_NUMBER_2> |
---
which will be unmasked back by the plugin for the final response:
Sure! Here's a formatted employee directory for your HR team:
---
### Employee Directory
| Name | Position | Employee ID | Contact Email | Phone Number |
|---------------|---------------------|---------------------|---------------------|-------------------|
| Robert Chen | UX Designer | UX123| rchen@acmetech.com | (555) 456-7890 |
| Maria Garcia | Product Manager | PM456| mgarcia@acmetech.com | (555) 345-6789 |
| John Smith | Senior Developer | AD789| jsmith@acmetech.com | (555) 234-5678 |
---