Privacy and data handling
Sensitive user data plus careless API calls = your company on the news. This lesson keeps you off the news.
A loud diary read aloud in a cafe. Privacy in AI is making sure the diary is only read where it should be, by whom it should be.
Best practices:
- Know your provider's data retention policy (OpenAI does not train on API data by default but check current terms).
- Minimize: only send the fields needed.
- Redact PII before LLM calls when possible.
- Avoid logging raw prompts that contain user PII.
- Region: check data residency requirements.
- Use private deployments for highly regulated data (self-hosted Llama, Azure OpenAI with no training).
- User consent and transparency: tell users you use AI, how, and on what.
PII redaction snippet:
import re
def redact(text):
text = re.sub(r"\b[\w.+-]+@[\w-]+\.[\w.-]+\b", "[EMAIL]", text)
text = re.sub(r"\b\d{10}\b", "[PHONE]", text)
return text
Then call the LLM with redact(user_text). Map back on the way out only if needed.
Quick recall
3 prompts · think before you flip
Prompt 1 of 3
Why minimize what you send?
Quiz time
1 question · tap an answer to check it
1. The cheapest privacy improvement most apps can make today is
Finished lesson 11.4?
Mark complete to update your module progress and unlock the streak.
Loading