fix(types): avoid mutable redaction return

This commit is contained in:
hansu650 2026-08-12 20:34:05 +08:00
parent d6fce94217
commit 0d5f0c44b5

View file

@ -5372,14 +5372,15 @@ def _parse_tool_call_arguments(raw: Any, tool_name: str | None, context: str) ->
return raw
if not isinstance(raw, str):
return {}
if raw == REDACTED_BY_LITELLM:
return {}
normalized_raw: Final = "{}" if raw == REDACTED_BY_LITELLM else raw
from litellm.litellm_core_utils.prompt_templates.common_utils import (
parse_tool_call_arguments,
)
try:
parsed: Final = parse_tool_call_arguments(raw, tool_name=tool_name, context=context)
parsed: Final = parse_tool_call_arguments(
normalized_raw, tool_name=tool_name, context=context
)
except ValueError as e:
verbose_logger.warning("Failed to parse tool call arguments: %s", e)
return {}