From 2c3ab41248990cae7579466db3f2ecc367064f2e Mon Sep 17 00:00:00 2001 From: joereyna Date: Thu, 16 Apr 2026 21:31:30 -0700 Subject: [PATCH] fix comment, remove unused var, add backward-compat alias for _build_guardrail_inputs --- litellm/llms/a2a/chat/guardrail_translation/handler.py | 4 ++-- litellm/llms/anthropic/chat/guardrail_translation/handler.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/litellm/llms/a2a/chat/guardrail_translation/handler.py b/litellm/llms/a2a/chat/guardrail_translation/handler.py index 3fb432efa63..8d56dbadfc3 100644 --- a/litellm/llms/a2a/chat/guardrail_translation/handler.py +++ b/litellm/llms/a2a/chat/guardrail_translation/handler.py @@ -245,8 +245,8 @@ class A2AGuardrailHandler(BaseTranslation): # Collect text from each chunk in order (by original index in responses_so_far) text_parts: List[str] = [] - chunk_indices_with_text: List[int] = [] # indices into valid_parsed - for idx, (orig_i, obj) in enumerate(valid_parsed): + chunk_indices_with_text: List[int] = [] # indices into responses_so_far + for orig_i, obj in valid_parsed: t = extract_text_from_a2a_response(obj) if t: text_parts.append(t) diff --git a/litellm/llms/anthropic/chat/guardrail_translation/handler.py b/litellm/llms/anthropic/chat/guardrail_translation/handler.py index 1c36e21de4e..81dfde35f37 100644 --- a/litellm/llms/anthropic/chat/guardrail_translation/handler.py +++ b/litellm/llms/anthropic/chat/guardrail_translation/handler.py @@ -408,6 +408,9 @@ class AnthropicMessagesHandler(BaseTranslation): inputs["model"] = response_model return inputs + # Backward-compat alias — subclasses that overrode _build_guardrail_inputs still work + _build_guardrail_inputs = _build_output_guardrail_inputs + async def process_output_streaming_response( self, responses_so_far: List[Any],