Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(policy_engine): move mutable-ok suppressions onto the flagged lines

mateo-berri85fea1a6752a
diff --git a/litellm/llms/openai/chat/guardrail_translation/handler.py b/litellm/llms/openai/chat/guardrail_translation/handler.py
index fcb447d5277..02206a36b0e 100644
--- a/litellm/llms/openai/chat/guardrail_translation/handler.py
+++ b/litellm/llms/openai/chat/guardrail_translation/handler.py
@@ -989,12 +989,8 @@ class OpenAIChatCompletionsHandler(BaseTranslation):
return
await self._apply_guardrail_responses_to_output_streaming(
responses=responses_so_far,
- guardrailed_texts=[
- after for _choice_idx, after in changed
- ], # mutable-ok: the callee's signature predates this change and takes lists
- task_mappings=[
- (choice_idx, None) for choice_idx, _after in changed
- ], # mutable-ok: the callee's signature predates this change and takes lists
+ guardrailed_texts=[after for _choice_idx, after in changed], # mutable-ok: callee takes lists
+ task_mappings=[(choice_idx, None) for choice_idx, _after in changed], # mutable-ok: callee takes lists
)
async def _apply_guardrail_responses_to_output_streaming(