mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-07 00:24:03 +00:00
Merge pull request #4210 from BerriAI/litellm_fix_redact_message_input_output_from_logging_deepcopy
[Fix] redact_message_input_output_from_logging deepcopy bug
This commit is contained in:
@@ -30,7 +30,6 @@ def redact_message_input_output_from_logging(
|
||||
if litellm.turn_off_message_logging is not True:
|
||||
return result
|
||||
|
||||
_result = copy.deepcopy(result)
|
||||
# remove messages, prompts, input, response from logging
|
||||
litellm_logging_obj.model_call_details["messages"] = [
|
||||
{"role": "user", "content": "redacted-by-litellm"}
|
||||
@@ -53,8 +52,10 @@ def redact_message_input_output_from_logging(
|
||||
elif isinstance(choice, litellm.utils.StreamingChoices):
|
||||
choice.delta.content = "redacted-by-litellm"
|
||||
else:
|
||||
if _result is not None:
|
||||
if isinstance(_result, litellm.ModelResponse):
|
||||
if result is not None:
|
||||
if isinstance(result, litellm.ModelResponse):
|
||||
# only deep copy litellm.ModelResponse
|
||||
_result = copy.deepcopy(result)
|
||||
if hasattr(_result, "choices") and _result.choices is not None:
|
||||
for choice in _result.choices:
|
||||
if isinstance(choice, litellm.Choices):
|
||||
|
||||
Reference in New Issue
Block a user