From 28a07ee1a4633430b804d9c62e916155181fa3a5 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Thu, 11 Jul 2024 21:14:46 -0700 Subject: [PATCH] docs(pii_masking.md): update docs --- docs/my-website/docs/proxy/pii_masking.md | 56 +++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/docs/my-website/docs/proxy/pii_masking.md b/docs/my-website/docs/proxy/pii_masking.md index a95a6d7712b..8106765f40e 100644 --- a/docs/my-website/docs/proxy/pii_masking.md +++ b/docs/my-website/docs/proxy/pii_masking.md @@ -179,4 +179,60 @@ chat_completion = client.chat.completions.create( }, "_response_ms": 1753.426 } +``` + + +## Turn on for logging only + +Only apply PII Masking before logging to Langfuse, etc. + +Not on the actual llm api request / response. + +:::note +This is currently only applied for +- `/chat/completion` requests +- on 'success' logging + +::: + +1. Setup config.yaml +```yaml +litellm_settings: + presidio_logging_only: true + +model_list: + - model_name: gpt-3.5-turbo + litellm_params: + model: gpt-3.5-turbo + api_key: os.environ/OPENAI_API_KEY +``` + +2. Start proxy + +```bash +litellm --config /path/to/config.yaml +``` + +3. Test it! + +```bash +curl -X POST 'http://0.0.0.0:4000/chat/completions' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer sk-1234' \ +-D '{ + "model": "gpt-3.5-turbo", + "messages": [ + { + "role": "user", + "content": "Hi, my name is Jane!" + } + ] + }' +``` + + +**Expected Logged Response** + +``` +Hi, my name is ! ``` \ No newline at end of file