mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
fix(responses): preserve Bedrock Mantle validation status (#36580)
This commit is contained in:
parent
f9a8c96b82
commit
c1662258df
2 changed files with 24 additions and 1 deletions
|
|
@ -2315,7 +2315,7 @@ def exception_type(
|
|||
exception_provider=exception_provider,
|
||||
extra_information=extra_information,
|
||||
)
|
||||
elif custom_llm_provider == "bedrock":
|
||||
elif custom_llm_provider in ("bedrock", "bedrock_mantle"):
|
||||
_map_bedrock_exception(
|
||||
model=model,
|
||||
original_exception=mappable_exception,
|
||||
|
|
|
|||
|
|
@ -762,3 +762,26 @@ def test_azure_404_with_invalid_request_error_type_maps_to_not_found():
|
|||
|
||||
assert excinfo.value.status_code == 404
|
||||
assert "Response with id 'resp_abc' not found." in excinfo.value.message
|
||||
|
||||
|
||||
def test_bedrock_mantle_400_maps_to_bad_request():
|
||||
from litellm.llms.base_llm.chat.transformation import BaseLLMException
|
||||
|
||||
original_exception = BaseLLMException(
|
||||
status_code=400,
|
||||
message=(
|
||||
'{"error": {"code": "validation_error", "message": '
|
||||
"\"invalid request body: Invalid 'input': value did not match any expected variant\", "
|
||||
'"type": "invalid_request_error"}}'
|
||||
),
|
||||
)
|
||||
|
||||
with pytest.raises(litellm.BadRequestError) as excinfo:
|
||||
exception_type(
|
||||
model="gpt-5.6-terra",
|
||||
original_exception=original_exception,
|
||||
custom_llm_provider="bedrock_mantle",
|
||||
)
|
||||
|
||||
assert excinfo.value.status_code == 400
|
||||
assert "Invalid 'input'" in excinfo.value.message
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue