Update litellm/integrations/custom_guardrail.py

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
This commit is contained in:
Harshit Jain 2026-02-27 13:27:14 +05:30 committed by GitHub
parent 9ed07e7172
commit 0cab023b4f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -142,7 +142,7 @@ class CustomGuardrail(CustomLogger):
Optional[List[int]],
]:
"""Filter to only the latest message for target_role."""
import copy
for index in range(len(messages) - 1, -1, -1):
if messages[index].get("role") == target_role: