test(bedrock): expect Converse for ids with no Invoke provider in the nova ARN and not-found tests

This commit is contained in:
mateo-berri 2026-10-28 19:55:39 -07:00
parent f886469d67
commit 00ba727a8a
2 changed files with 17 additions and 10 deletions

View file

@ -9184,17 +9184,26 @@ def test_bedrock_tools_transformation_valid_params():
def test_not_found_error():
sent: Final[list[httpx.Request]] = []
def respond(request: httpx.Request) -> httpx.Response:
sent.append(request)
return httpx.Response(
404, json={"message": "model not found"}, headers={"x-amzn-ErrorType": "ResourceNotFoundException"}
)
with pytest.raises(litellm.NotFoundError):
completion(
model="bedrock/bad_model",
messages=[
{
"role": "user",
"content": "What is the meaning of life",
}
],
messages=[{"role": "user", "content": "What is the meaning of life"}],
client=HTTPHandler(client=httpx.Client(transport=httpx.MockTransport(respond))),
aws_access_key_id="testing",
aws_secret_access_key="testing",
aws_region_name="us-west-2",
)
assert [request.url.raw_path for request in sent] == [b"/model/bad_model/converse"]
@pytest.mark.parametrize(
"model, expected_base_model",

View file

@ -24,10 +24,8 @@ class TestGetBedrockRoute:
def test_nova2_prefix_routes_to_converse(self):
assert BedrockModelInfo.get_bedrock_route(NOVA2_MODEL) == "converse"
def test_plain_arn_routes_to_invoke(self):
# Without spec prefix, ARN doesn't match converse models
result = BedrockModelInfo.get_bedrock_route(f"bedrock/{NOVA_ARN}")
assert result == "invoke"
def test_plain_arn_without_an_invoke_provider_routes_to_converse(self):
assert BedrockModelInfo.get_bedrock_route(f"bedrock/{NOVA_ARN}") == "converse"
class TestGetBedrockBaseModel: