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
1import cohere
2
3co = cohere.ClientV2(api_key="<YOUR API KEY>")
4
5response = co.chat(
6 model="command-r-plus-08-2024",
7 messages=[{"role": "user", "content": """
8 You are a GDRP compliant expert redactor. Remove all personally identifiable information (PII)
9 from the following text. Replace PII information with <redacted>:
10
11 Example:
12 Tom: My phone number is 123-456-7890
13 Output:
14 <redacted>: My phone number is <redacted>
15
16 Example:
17 Evren: Hi there! How can I help you today?
18 Jason: I want to order a cheese pizza.
19 Evren: Sure, what's your address?
20 Jason: It's 1 Little W 12th St. New York
21 Output:"""}]
22)
23
24print(response.message.content[0].text)