mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-08 03:08:45 +00:00
Merge pull request #4352 from msabramo/msabramo/turn-on-message-logging-via-request-header
Disable message redaction in logs via request header
This commit is contained in:
commit
9bffa9a48e
2 changed files with 24 additions and 1 deletions
|
|
@ -210,6 +210,24 @@ litellm_settings:
|
|||
turn_off_message_logging: True
|
||||
```
|
||||
|
||||
If you have this feature turned on, you can override it for specific requests by
|
||||
setting a request header `LiteLLM-Disable-Message-Redaction: true`.
|
||||
|
||||
```shell
|
||||
curl --location 'http://0.0.0.0:4000/chat/completions' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--header 'LiteLLM-Disable-Message-Redaction: true' \
|
||||
--data '{
|
||||
"model": "gpt-3.5-turbo",
|
||||
"messages": [
|
||||
{
|
||||
"role": "user",
|
||||
"content": "what llm are you"
|
||||
}
|
||||
]
|
||||
}'
|
||||
```
|
||||
|
||||
### 🔧 Debugging - Viewing RAW CURL sent from LiteLLM to provider
|
||||
|
||||
Use this when you want to view the RAW curl request sent from LiteLLM to the LLM API
|
||||
|
|
|
|||
|
|
@ -28,8 +28,13 @@ def redact_message_input_output_from_logging(
|
|||
Removes messages, prompts, input, response from logging. This modifies the data in-place
|
||||
only redacts when litellm.turn_off_message_logging == True
|
||||
"""
|
||||
request_headers = litellm_logging_obj.model_call_details['litellm_params']['metadata']['headers']
|
||||
|
||||
# check if user opted out of logging message/response to callbacks
|
||||
if litellm.turn_off_message_logging is not True:
|
||||
if litellm.turn_off_message_logging is not True and request_headers.get('litellm-enable-message-redaction', False):
|
||||
return result
|
||||
|
||||
if request_headers and request_headers.get('litellm-disable-message-redaction', False):
|
||||
return result
|
||||
|
||||
# remove messages, prompts, input, response from logging
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue