diff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.py index 6f587abcdf1..335a0a1a940 100644 --- a/litellm/litellm_core_utils/litellm_logging.py +++ b/litellm/litellm_core_utils/litellm_logging.py @@ -4827,9 +4827,16 @@ class StandardLoggingPayloadSetup: else: final_response_obj = {} + # Pass the original BaseModel object to redaction so isinstance checks inside + # perform_redaction work correctly (a plain dict never matches ModelResponse etc.) + redaction_input = ( + init_response_obj + if isinstance(init_response_obj, BaseModel) + else final_response_obj + ) modified_final_response_obj = redact_message_input_output_from_logging( model_call_details=kwargs, - result=final_response_obj, + result=redaction_input, ) if modified_final_response_obj is not None and isinstance( diff --git a/litellm/litellm_core_utils/redact_messages.py b/litellm/litellm_core_utils/redact_messages.py index ad68f3851a8..cc41696c5ac 100644 --- a/litellm/litellm_core_utils/redact_messages.py +++ b/litellm/litellm_core_utils/redact_messages.py @@ -49,6 +49,8 @@ def _redact_choice_content(choice): choice.message.reasoning_content = "redacted-by-litellm" if hasattr(choice.message, "thinking_blocks"): choice.message.thinking_blocks = None + if hasattr(choice.message, "audio"): + choice.message.audio = None elif isinstance(choice, litellm.utils.StreamingChoices): choice.delta.content = "redacted-by-litellm" if hasattr(choice.delta, "reasoning_content"):