mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
fix(bedrock_httpx.py): raise bad request error if invalid bedrock model given
This commit is contained in:
parent
b8e5b25dcc
commit
66d77f177f
2 changed files with 17 additions and 3 deletions
|
|
@ -1054,10 +1054,11 @@ class BedrockLLM(BaseLLM):
|
|||
"complete_input_dict": inference_params,
|
||||
},
|
||||
)
|
||||
raise Exception(
|
||||
"Bedrock HTTPX: Unsupported provider={}, model={}".format(
|
||||
raise BedrockError(
|
||||
status_code=400,
|
||||
message="Bedrock HTTPX: Unsupported provider={}, model={}".format(
|
||||
provider, model
|
||||
)
|
||||
),
|
||||
)
|
||||
|
||||
## COMPLETION CALL
|
||||
|
|
|
|||
|
|
@ -1157,3 +1157,16 @@ def test_bedrock_tools_pt_invalid_names():
|
|||
assert len(result) == 2
|
||||
assert result[0]["toolSpec"]["name"] == "a123_invalid_name"
|
||||
assert result[1]["toolSpec"]["name"] == "another_invalid_name"
|
||||
|
||||
|
||||
def test_bad_request_error():
|
||||
with pytest.raises(litellm.BadRequestError):
|
||||
completion(
|
||||
model="bedrock/bad_model",
|
||||
messages=[
|
||||
{
|
||||
"role": "user",
|
||||
"content": "What is the meaning of life",
|
||||
}
|
||||
],
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue