Skip to content

Conversation

@orolega
Copy link
Contributor

@orolega orolega commented Nov 27, 2025

Title

Improve Bedrock Guardrails: Async Hook Fix

Relevant issues

N/A

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem
image

Type

🐛 Bug Fix
✅ Test

Changes

Previously, the async_post_call_success_hook method in BedrockGuardrail was modifying the response in-place but not returning it. Now the response is being lost when using a post_call Bedrock guardrail as it is no longer being modified in place. This results in no response being sent back to the client.

This fix ensures the response object is properly returned after applying guardrail checks and masking, maintaining consistency with other guardrail implementations (AIM, Pangea, etc.) and the pre_call hook behavior.

  • Add return statement in async_post_call_success_hook
  • Add test to verify response is returned correctly
  • Update test comment for clarity

@vercel
Copy link

vercel bot commented Nov 27, 2025

@orolega is attempting to deploy a commit to the CLERKIEAI Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant