Skip to content

Commit 5b080e2

Browse files
committed
removes HTTP exception for faulty guardrail
1 parent f387803 commit 5b080e2

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

litellm/proxy/guardrails/guardrail_hooks/bedrock_guardrails.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -384,9 +384,6 @@ async def make_bedrock_api_request(
384384
)
385385
#########################################################
386386
if response.status_code == 200:
387-
# check if the response contains an error
388-
if self._check_bedrock_response_for_exception(response=response):
389-
raise self._get_http_exception_for_failed_guardrail(response)
390387
# check if the response was flagged
391388
_json_response = response.json()
392389
redacted_response = _redact_pii_matches(_json_response)
@@ -452,19 +449,6 @@ def _get_bedrock_guardrail_response_status(
452449
return "success"
453450
return "failure"
454451

455-
def _get_http_exception_for_failed_guardrail(
456-
self, response: httpx.Response
457-
) -> HTTPException:
458-
return HTTPException(
459-
status_code=400,
460-
detail={
461-
"error": "Guardrail application failed.",
462-
"bedrock_guardrail_response": json.loads(
463-
response.content.decode("utf-8")
464-
).get("Output", {}),
465-
},
466-
)
467-
468452
def _get_http_exception_for_blocked_guardrail(
469453
self, response: BedrockGuardrailResponse
470454
) -> HTTPException:

0 commit comments

Comments
 (0)