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]

removes HTTP exception for faulty guardrail

=5b080e20c4cb
diff --git a/litellm/proxy/guardrails/guardrail_hooks/bedrock_guardrails.py b/litellm/proxy/guardrails/guardrail_hooks/bedrock_guardrails.py
index be394b5ad98..462582b1f35 100644
--- a/litellm/proxy/guardrails/guardrail_hooks/bedrock_guardrails.py
+++ b/litellm/proxy/guardrails/guardrail_hooks/bedrock_guardrails.py
@@ -384,9 +384,6 @@ class BedrockGuardrail(CustomGuardrail, BaseAWSLLM):
)
#########################################################
if response.status_code == 200:
- # check if the response contains an error
- if self._check_bedrock_response_for_exception(response=response):
- raise self._get_http_exception_for_failed_guardrail(response)
# check if the response was flagged
_json_response = response.json()
redacted_response = _redact_pii_matches(_json_response)
@@ -452,19 +449,6 @@ class BedrockGuardrail(CustomGuardrail, BaseAWSLLM):
return "success"
return "failure"
- def _get_http_exception_for_failed_guardrail(
- self, response: httpx.Response
- ) -> HTTPException:
- return HTTPException(
- status_code=400,
- detail={
- "error": "Guardrail application failed.",
- "bedrock_guardrail_response": json.loads(
- response.content.decode("utf-8")
- ).get("Output", {}),
- },
- )
-
def _get_http_exception_for_blocked_guardrail(
self, response: BedrockGuardrailResponse
) -> HTTPException: