mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-06 02:48:13 +00:00
refactor(logging): drop rebinding and comment in failure redaction
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
d733288425
commit
935f51a8b6
2 changed files with 10 additions and 10 deletions
|
|
@ -9,7 +9,11 @@ from typing import TYPE_CHECKING, Any, ClassVar, Final, Optional, cast
|
|||
from pydantic import BaseModel
|
||||
|
||||
from litellm._logging import verbose_logger
|
||||
from litellm.constants import DEFAULT_MAX_RECURSE_DEPTH_SENSITIVE_DATA_MASKER, EMPTY_MAPPING
|
||||
from litellm.constants import (
|
||||
DEFAULT_MAX_RECURSE_DEPTH_SENSITIVE_DATA_MASKER,
|
||||
EMPTY_MAPPING,
|
||||
REDACTED_BY_LITELLM,
|
||||
)
|
||||
from litellm.types.integrations.argilla import ArgillaItem
|
||||
from litellm.types.integrations.custom_logger import AgenticLoopPlan
|
||||
from litellm.types.llms.openai import AllMessageValues, ChatCompletionRequest
|
||||
|
|
@ -962,10 +966,8 @@ class CustomLogger: # https://docs.litellm.ai/docs/observability/custom_callbac
|
|||
standard_logging_object_copy["response"] = model_response_dict
|
||||
|
||||
if turn_off_message_logging:
|
||||
# Error text can quote the prompt; callbacks never scrub it themselves,
|
||||
# so redact it regardless of `redacts_messages_itself`.
|
||||
if standard_logging_object_copy.get("error_str"):
|
||||
standard_logging_object_copy["error_str"] = "redacted-by-litellm"
|
||||
standard_logging_object_copy["error_str"] = REDACTED_BY_LITELLM
|
||||
error_information: Final = standard_logging_object_copy.get("error_information")
|
||||
if isinstance(error_information, Mapping):
|
||||
from litellm.litellm_core_utils.redact_messages import redact_error_information
|
||||
|
|
@ -982,7 +984,7 @@ class CustomLogger: # https://docs.litellm.ai/docs/observability/custom_callbac
|
|||
else EMPTY_MAPPING
|
||||
)
|
||||
redacted_failure_fields: Final = (
|
||||
MappingProxyType({"traceback_exception": "redacted-by-litellm"})
|
||||
MappingProxyType({"traceback_exception": REDACTED_BY_LITELLM})
|
||||
if turn_off_message_logging and model_call_details.get("traceback_exception")
|
||||
else EMPTY_MAPPING
|
||||
)
|
||||
|
|
|
|||
|
|
@ -3900,11 +3900,9 @@ class Logging(LiteLLMLoggingBaseClass):
|
|||
global_callbacks=litellm._async_failure_callback,
|
||||
)
|
||||
|
||||
result: object = None # result sent to all loggers, init this to None incase it's not created
|
||||
|
||||
result = redact_message_input_output_from_logging(
|
||||
model_call_details=(self.model_call_details if hasattr(self, "model_call_details") else {}),
|
||||
result=result,
|
||||
result: Final = redact_message_input_output_from_logging(
|
||||
model_call_details=self.model_call_details,
|
||||
result=None,
|
||||
)
|
||||
self.has_run_logging(event_type="async_failure")
|
||||
for callback in callbacks:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue