mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-09 22:31:41 +00:00
fix(guardrails): raise 500 when Bedrock reports a failure inside a 200 body
Also types the credentials parameter on the new chunking helpers and rebuilds fragment grouping without mutating a list or rebinding an index
This commit is contained in:
parent
a6ad663af1
commit
a08e4cf309
1 changed files with 2 additions and 1 deletions
|
|
@ -4616,12 +4616,13 @@ async def test_apply_guardrail_exception_inside_200_logs_failure_not_success():
|
||||||
):
|
):
|
||||||
mock_post.return_value = exception_response
|
mock_post.return_value = exception_response
|
||||||
|
|
||||||
with pytest.raises(HTTPException):
|
with pytest.raises(HTTPException) as raised:
|
||||||
await guardrail.make_bedrock_api_request(
|
await guardrail.make_bedrock_api_request(
|
||||||
source="INPUT",
|
source="INPUT",
|
||||||
messages=[{"role": "user", "content": "hello"}],
|
messages=[{"role": "user", "content": "hello"}],
|
||||||
request_data={"model": "bedrock-nova-micro"},
|
request_data={"model": "bedrock-nova-micro"},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
assert raised.value.status_code == 500
|
||||||
mock_log.assert_called_once()
|
mock_log.assert_called_once()
|
||||||
assert mock_log.call_args.kwargs["guardrail_status"] == "guardrail_failed_to_respond"
|
assert mock_log.call_args.kwargs["guardrail_status"] == "guardrail_failed_to_respond"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue