From 0d5f0c44b59527aaf9fe9f8cacd33cda08c0d801 Mon Sep 17 00:00:00 2001 From: hansu650 <2788086371@qq.com> Date: Wed, 12 Aug 2026 20:34:05 +0800 Subject: [PATCH] fix(types): avoid mutable redaction return --- litellm/litellm_core_utils/prompt_templates/factory.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/litellm/litellm_core_utils/prompt_templates/factory.py b/litellm/litellm_core_utils/prompt_templates/factory.py index 320219f710a..2a9d258e9af 100644 --- a/litellm/litellm_core_utils/prompt_templates/factory.py +++ b/litellm/litellm_core_utils/prompt_templates/factory.py @@ -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 {}