mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-24 00:52:24 +00:00
test(bedrock): point unit tests at model ids still in the cost map (#42606)
#42521 retired the cohere.command-r ids from the cost map, and a bare Bedrock id resolves its provider through that map, so test_model_group_info and the cohere cases in test_bedrock_dynamic_auth_params_unit_tests failed with LLM Provider NOT provided. The completion tests keep the cohere invoke request and URL assertions through the bedrock/ prefix, the bare parametrize entry moves to amazon.nova-2-lite-v1:0 with the mock response shape picked by the real Bedrock route, and the router test builds its group info from bedrock/amazon.nova-2-lite-v1:0. Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
This commit is contained in:
parent
392e807172
commit
3c3803f37a
2 changed files with 12 additions and 8 deletions
|
|
@ -9,6 +9,7 @@ import litellm
|
|||
from litellm.llms.custom_httpx.http_handler import HTTPHandler
|
||||
from unittest.mock import Mock
|
||||
from litellm.llms.bedrock.base_aws_llm import BaseAWSLLM
|
||||
from litellm.llms.bedrock.common_utils import BedrockModelInfo
|
||||
|
||||
|
||||
|
||||
|
|
@ -42,7 +43,7 @@ def test_bedrock_completion_with_region_name():
|
|||
|
||||
# Pass the client so that the HTTP call will be intercepted.
|
||||
response = litellm.completion(
|
||||
model="cohere.command-r-v1:0",
|
||||
model="bedrock/cohere.command-r-v1:0",
|
||||
messages=[{"role": "user", "content": "Hello, world!"}],
|
||||
aws_region_name="us-west-12",
|
||||
client=client,
|
||||
|
|
@ -98,7 +99,7 @@ def test_bedrock_completion_with_dynamic_authentication_params():
|
|||
|
||||
# Pass the client so that the HTTP call will be intercepted.
|
||||
response = litellm.completion(
|
||||
model="cohere.command-r-v1:0",
|
||||
model="bedrock/cohere.command-r-v1:0",
|
||||
messages=[{"role": "user", "content": "Hello, world!"}],
|
||||
aws_access_key_id="dynamically_generated_access_key_id",
|
||||
aws_secret_access_key="dynamically_generated_secret_access_key",
|
||||
|
|
@ -146,7 +147,7 @@ def test_bedrock_completion_with_dynamic_bedrock_runtime_endpoint():
|
|||
|
||||
# Pass the client so that the HTTP call will be intercepted.
|
||||
response = litellm.completion(
|
||||
model="cohere.command-r-v1:0",
|
||||
model="bedrock/cohere.command-r-v1:0",
|
||||
messages=[{"role": "user", "content": "Hello, world!"}],
|
||||
aws_bedrock_runtime_endpoint="https://my-fake-endpoint.com",
|
||||
client=client,
|
||||
|
|
@ -179,7 +180,7 @@ class DummyCredentials:
|
|||
"model",
|
||||
[
|
||||
"bedrock/converse/cohere.command-r-v1:0",
|
||||
"cohere.command-r-v1:0",
|
||||
"amazon.nova-2-lite-v1:0",
|
||||
"bedrock/cohere.command-r-v1:0",
|
||||
"bedrock/invoke/cohere.command-r-v1:0",
|
||||
],
|
||||
|
|
@ -250,7 +251,7 @@ def test_dynamic_aws_params_propagation(model, param_name, param_value, expected
|
|||
"finish_reason": "COMPLETE",
|
||||
}
|
||||
)
|
||||
if "converse" in model:
|
||||
if BedrockModelInfo.get_bedrock_route(model) == "converse":
|
||||
mock_response.text = json.dumps(
|
||||
{
|
||||
"output": {
|
||||
|
|
|
|||
|
|
@ -1284,15 +1284,18 @@ def test_model_group_info():
|
|||
router = Router(
|
||||
model_list=[
|
||||
{
|
||||
"model_name": "command-r-plus",
|
||||
"litellm_params": {"model": "cohere.command-r-plus-v1:0"},
|
||||
"model_name": "nova-2-lite",
|
||||
"litellm_params": {"model": "bedrock/amazon.nova-2-lite-v1:0"},
|
||||
}
|
||||
]
|
||||
)
|
||||
|
||||
response = router.get_model_group_info(model_group="command-r-plus")
|
||||
response = router.get_model_group_info(model_group="nova-2-lite")
|
||||
|
||||
assert response is not None
|
||||
assert response.model_group == "nova-2-lite"
|
||||
assert response.providers == ["bedrock"]
|
||||
assert response.max_input_tokens is not None
|
||||
|
||||
|
||||
def test_consistent_model_id():
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue