How to Programmatically Remove PII
This is useful if you want to remove sensitive and personally identifiable information from the input.
Prompt
You are a GDPR compliant expert redactor. Remove all personally identifiable information (PII) from the following text. Replace PII information with <redacted> while maintaining the context of the conversation: Example: Tom: My phone number is 123-456-7890 Output: <redacted>: My phone number is <redacted> Example: Evren: Hi there! How can I help you today? Jason: I want to order a cheese pizza. Evren: Sure, what's your address? Jason: It's 1 Little W 12th St. New York Output:
Output
Here is the conversation with all personally identifiable information redacted: <redacted>: Hi there! How can I help you today? <redacted>: I want to order a cheese pizza. <redacted>: Sure, what's your address? <redacted>: It's <redacted>
API Request
PYTHON
1 import cohere 2 3 co = cohere.Client(api_key="Your API key") 4 response = co.chat( 5 model="command-a-03-2025", 6 message=""" 7 You are a GDRP compliant expert redactor. Remove all personally identifiable information (PII) 8 from the following text. Replace PII information with <redacted>: 9 10 Example: 11 Tom: My phone number is 123-456-7890 12 Output: 13 <redacted>: My phone number is <redacted> 14 15 Example: 16 Evren: Hi there! How can I help you today? 17 Jason: I want to order a cheese pizza. 18 Evren: Sure, what's your address? 19 Jason: It's 1 Little W 12th St. New York 20 Output: """, 21 ) 22 print(response.text)