mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-28 04:04:31 +00:00
fix redact_message_input_output_from_logging
This commit is contained in:
parent
74c321fb45
commit
b5aa1ced06
1 changed files with 4 additions and 3 deletions
|
@ -30,7 +30,6 @@ def redact_message_input_output_from_logging(
|
||||||
if litellm.turn_off_message_logging is not True:
|
if litellm.turn_off_message_logging is not True:
|
||||||
return result
|
return result
|
||||||
|
|
||||||
_result = copy.deepcopy(result)
|
|
||||||
# remove messages, prompts, input, response from logging
|
# remove messages, prompts, input, response from logging
|
||||||
litellm_logging_obj.model_call_details["messages"] = [
|
litellm_logging_obj.model_call_details["messages"] = [
|
||||||
{"role": "user", "content": "redacted-by-litellm"}
|
{"role": "user", "content": "redacted-by-litellm"}
|
||||||
|
@ -53,8 +52,10 @@ def redact_message_input_output_from_logging(
|
||||||
elif isinstance(choice, litellm.utils.StreamingChoices):
|
elif isinstance(choice, litellm.utils.StreamingChoices):
|
||||||
choice.delta.content = "redacted-by-litellm"
|
choice.delta.content = "redacted-by-litellm"
|
||||||
else:
|
else:
|
||||||
if _result is not None:
|
if result is not None:
|
||||||
if isinstance(_result, litellm.ModelResponse):
|
if isinstance(result, litellm.ModelResponse):
|
||||||
|
# only deep copy litellm.ModelResponse
|
||||||
|
_result = copy.deepcopy(result)
|
||||||
if hasattr(_result, "choices") and _result.choices is not None:
|
if hasattr(_result, "choices") and _result.choices is not None:
|
||||||
for choice in _result.choices:
|
for choice in _result.choices:
|
||||||
if isinstance(choice, litellm.Choices):
|
if isinstance(choice, litellm.Choices):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue