feat(presidio_pii_masking.py): allow request level controls for turning on/off pii masking

https://github.com/BerriAI/litellm/issues/2003
This commit is contained in:
Krrish Dholakia 2024-02-17 11:04:56 -08:00 committed by ishaan-jaff
parent 0febb44c5a
commit 579677886a
3 changed files with 141 additions and 4 deletions

View file

@ -3156,6 +3156,19 @@ async def generate_key_fn(
- permissions: Optional[dict] - key-specific permissions. Currently just used for turning off pii masking (if connected). Example - {"pii": false}
- model_max_budget: Optional[dict] - key-specific model budget in USD. Example - {"text-davinci-002": 0.5, "gpt-3.5-turbo": 0.5}. IF null or {} then no model specific budget.
Examples:
1. Allow users to turn on/off pii masking
```bash
curl --location 'http://0.0.0.0:8000/key/generate' \
--header 'Authorization: Bearer sk-1234' \
--header 'Content-Type: application/json' \
--data '{
"permissions": {"allow_pii_controls": true}
}'
```
Returns:
- key: (str) The generated api key
- expires: (datetime) Datetime object for when key expires.