mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-25 01:02:15 +00:00
test: point CircleCI-only suites at models still in the cost map (#42617)
* test: point CircleCI-only suites at models still in the cost map #42435 removed cost map entries past their deprecation date and #42437 added litellm_uisettings to the config-synced tables, but both only updated tests/test_litellm. The CircleCI-only suites (local_testing, llm_translation, logging_callback_tests, litellm_utils_tests, unit) kept using the removed models or the old table list and went red on main. Each test keeps its assertions and swaps the removed model for a current one with the same provider and capabilities. The fireworks tests pick a vision model from the cost map because #34941 set supports_vision false on minimax-m3, and the vertex image provider test injects the image model set because #42435 removed every vertex_ai-image-models entry. * test(vertex_ai): register the image model through add_known_models in the provider test
This commit is contained in:
parent
ca95fc2bd4
commit
4f93e2c3da
20 changed files with 93 additions and 76 deletions
|
|
@ -263,7 +263,7 @@ def test_trimming_should_not_change_original_messages():
|
|||
assert messages == messages_copy
|
||||
|
||||
|
||||
@pytest.mark.parametrize("model", ["gpt-4-0125-preview", "claude-sonnet-4-6"])
|
||||
@pytest.mark.parametrize("model", ["gpt-5.4-mini", "claude-sonnet-4-6"])
|
||||
def test_trimming_with_model_cost_max_input_tokens(model):
|
||||
messages = [
|
||||
{"role": "system", "content": "This is a normal system message"},
|
||||
|
|
|
|||
|
|
@ -9,6 +9,12 @@ from litellm.llms.fireworks_ai.chat.transformation import FireworksAIConfig
|
|||
|
||||
fireworks = FireworksAIConfig()
|
||||
|
||||
VISION_MODEL = next(
|
||||
key.removeprefix("fireworks_ai/")
|
||||
for key, info in litellm.model_cost.items()
|
||||
if key.startswith("fireworks_ai/accounts/fireworks/models/") and info.get("supports_vision") is True
|
||||
)
|
||||
|
||||
|
||||
def test_map_openai_params_tool_choice():
|
||||
# Test case 1: tool_choice is "required"
|
||||
|
|
@ -97,7 +103,7 @@ def test_document_inlining_example(disable_add_transform_inline_image_block):
|
|||
with patch.object(client, "post") as mock_post:
|
||||
try:
|
||||
completion(
|
||||
model="fireworks_ai/accounts/fireworks/models/minimax-m3",
|
||||
model=f"fireworks_ai/{VISION_MODEL}",
|
||||
messages=[
|
||||
{
|
||||
"role": "user",
|
||||
|
|
@ -157,7 +163,7 @@ def test_transform_inline_no_longer_added(content, expected_url):
|
|||
|
||||
result = litellm.FireworksAIConfig()._transform_messages_helper(
|
||||
messages=messages,
|
||||
model="accounts/fireworks/models/minimax-m3",
|
||||
model=VISION_MODEL,
|
||||
litellm_params={},
|
||||
)
|
||||
result_image_block = result[0]["content"][0]
|
||||
|
|
@ -182,7 +188,7 @@ def test_global_disable_flag_no_longer_adds_transform_inline(is_disabled):
|
|||
]
|
||||
result = litellm.FireworksAIConfig()._transform_messages_helper(
|
||||
messages=messages,
|
||||
model="accounts/fireworks/models/minimax-m3",
|
||||
model=VISION_MODEL,
|
||||
litellm_params={},
|
||||
)
|
||||
assert result[0]["content"][0]["image_url"] == url
|
||||
|
|
@ -204,7 +210,7 @@ def test_global_disable_flag_with_transform_messages_helper(monkeypatch):
|
|||
) as mock_post:
|
||||
try:
|
||||
completion(
|
||||
model="fireworks_ai/accounts/fireworks/models/minimax-m3",
|
||||
model=f"fireworks_ai/{VISION_MODEL}",
|
||||
messages=[
|
||||
{
|
||||
"role": "user",
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ def test_gemini_image_generation_accumulates_multiple_image_prompt_token_details
|
|||
os.environ["LITELLM_LOCAL_MODEL_COST_MAP"] = "True"
|
||||
litellm.model_cost = litellm.get_model_cost_map(url="")
|
||||
|
||||
model = "gemini/gemini-3-pro-image-preview"
|
||||
model = "gemini/gemini-3-pro-image"
|
||||
config = GoogleImageGenConfig()
|
||||
|
||||
usage_metadata = {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class TestGroq(BaseLLMChatTest):
|
|||
|
||||
@pytest.mark.parametrize(
|
||||
"model",
|
||||
["groq/qwen/qwen3-32b", "groq/openai/gpt-oss-20b", "groq/openai/gpt-oss-120b"],
|
||||
["groq/qwen/qwen3.8-27b", "groq/openai/gpt-oss-20b", "groq/openai/gpt-oss-120b"],
|
||||
)
|
||||
def test_reasoning_effort_in_supported_params(self, model):
|
||||
"""Test that reasoning_effort is in the list of supported parameters for Groq"""
|
||||
|
|
|
|||
|
|
@ -537,7 +537,7 @@ def test_dynamic_drop_params_e2e():
|
|||
) as mock_response:
|
||||
try:
|
||||
response = litellm.completion(
|
||||
model="command-r",
|
||||
model="command-r-08-2024",
|
||||
messages=[{"role": "user", "content": "Hey, how's it going?"}],
|
||||
response_format={"key": "value"},
|
||||
drop_params=True,
|
||||
|
|
@ -556,7 +556,7 @@ def test_dynamic_pass_additional_params():
|
|||
) as mock_response:
|
||||
try:
|
||||
response = litellm.completion(
|
||||
model="command-r",
|
||||
model="command-r-08-2024",
|
||||
messages=[{"role": "user", "content": "Hey, how's it going?"}],
|
||||
custom_param="test",
|
||||
api_key="my-custom-key",
|
||||
|
|
@ -606,7 +606,7 @@ def test_dynamic_drop_params_parallel_tool_calls():
|
|||
) as mock_response:
|
||||
try:
|
||||
response = litellm.completion(
|
||||
model="command-r",
|
||||
model="command-r-08-2024",
|
||||
messages=[{"role": "user", "content": "Hey, how's it going?"}],
|
||||
parallel_tool_calls=True,
|
||||
drop_params=True,
|
||||
|
|
@ -663,7 +663,7 @@ def test_dynamic_drop_additional_params_e2e():
|
|||
) as mock_response:
|
||||
try:
|
||||
response = litellm.completion(
|
||||
model="command-r",
|
||||
model="command-r-08-2024",
|
||||
messages=[{"role": "user", "content": "Hey, how's it going?"}],
|
||||
response_format={"key": "value"},
|
||||
additional_drop_params=["response_format"],
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ def test_xai_message_name_filtering():
|
|||
class TestXAIReasoningEffort(BaseReasoningLLMTests):
|
||||
def get_base_completion_call_args(self):
|
||||
return {
|
||||
"model": "xai/grok-3-mini-beta",
|
||||
"model": "xai/grok-4.7",
|
||||
"messages": [{"role": "user", "content": "Hello"}],
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2863,7 +2863,7 @@ def test_gemini_function_call_parameter_in_messages():
|
|||
mock_client.return_value = mock_response
|
||||
try:
|
||||
completion(
|
||||
model="vertex_ai/gemini-2.0-flash",
|
||||
model="vertex_ai/gemini-2.5-flash-preview-09-2025",
|
||||
messages=messages,
|
||||
tools=tools,
|
||||
tool_choice="auto",
|
||||
|
|
@ -3263,7 +3263,7 @@ def test_vertex_anthropic_completion():
|
|||
client, "post", side_effect=vertex_ai_anthropic_thinking_mock_response
|
||||
):
|
||||
response = completion(
|
||||
model="vertex_ai/claude-3-7-sonnet@20250219",
|
||||
model="vertex_ai/claude-sonnet-4-6@default",
|
||||
messages=[{"role": "user", "content": "Hello, world!"}],
|
||||
vertex_ai_location="us-east5",
|
||||
vertex_ai_project="test-project",
|
||||
|
|
@ -3271,7 +3271,7 @@ def test_vertex_anthropic_completion():
|
|||
client=client,
|
||||
)
|
||||
print(response)
|
||||
assert response.model == "claude-3-7-sonnet@20250219"
|
||||
assert response.model == "claude-sonnet-4-6@default"
|
||||
assert response._hidden_params["response_cost"] is not None
|
||||
assert response._hidden_params["response_cost"] > 0
|
||||
|
||||
|
|
|
|||
|
|
@ -445,7 +445,7 @@ def test_groq_response_cost_tracking(is_streaming):
|
|||
|
||||
response_cost = litellm.response_cost_calculator(
|
||||
response_object=response,
|
||||
model="groq/llama-3.3-70b-versatile",
|
||||
model="groq/openai/gpt-oss-120b",
|
||||
custom_llm_provider="groq",
|
||||
call_type=CallTypes.acompletion.value,
|
||||
optional_params={},
|
||||
|
|
@ -515,7 +515,7 @@ def test_gemini_completion_cost(provider):
|
|||
"""
|
||||
os.environ["LITELLM_LOCAL_MODEL_COST_MAP"] = "True"
|
||||
litellm.model_cost = litellm.get_model_cost_map(url="")
|
||||
model_name = "gemini-2.0-flash"
|
||||
model_name = "gemini-3.8-flash"
|
||||
prompt_tokens = 128.0
|
||||
output_tokens = 228.0
|
||||
## GET MODEL FROM LITELLM.MODEL_INFO
|
||||
|
|
@ -543,7 +543,7 @@ def test_vertex_ai_completion_cost():
|
|||
|
||||
prompt_tokens = 100
|
||||
|
||||
model_info = litellm.get_model_info(model="gemini-2.0-flash")
|
||||
model_info = litellm.get_model_info(model="gemini-3.8-flash")
|
||||
|
||||
print("\nExpected model info:\n{}\n\n".format(model_info))
|
||||
|
||||
|
|
@ -551,7 +551,7 @@ def test_vertex_ai_completion_cost():
|
|||
|
||||
## CALCULATED COST
|
||||
calculated_input_cost, calculated_output_cost = cost_per_token(
|
||||
model="gemini-2.0-flash",
|
||||
model="gemini-3.8-flash",
|
||||
custom_llm_provider="vertex_ai",
|
||||
prompt_tokens=prompt_tokens,
|
||||
completion_tokens=0,
|
||||
|
|
@ -676,7 +676,7 @@ async def test_completion_cost_hidden_params(sync_mode):
|
|||
|
||||
|
||||
def test_vertex_ai_gemini_predict_cost():
|
||||
model = "gemini-2.0-flash"
|
||||
model = "gemini-3.8-flash"
|
||||
messages = [{"role": "user", "content": "Hey, hows it going???"}]
|
||||
predictive_cost = completion_cost(model=model, messages=messages)
|
||||
|
||||
|
|
@ -757,24 +757,24 @@ def test_completion_cost_tts(model):
|
|||
|
||||
def test_completion_cost_anthropic():
|
||||
"""
|
||||
model_name: claude-3-haiku-20240307
|
||||
model_name: claude-haiku-4-5
|
||||
litellm_params:
|
||||
model: anthropic/claude-3-haiku-20240307
|
||||
model: anthropic/claude-haiku-4-5
|
||||
max_tokens: 4096
|
||||
"""
|
||||
router = litellm.Router(
|
||||
model_list=[
|
||||
{
|
||||
"model_name": "claude-3-haiku-20240307",
|
||||
"model_name": "claude-haiku-4-5",
|
||||
"litellm_params": {
|
||||
"model": "anthropic/claude-3-haiku-20240307",
|
||||
"model": "anthropic/claude-haiku-4-5",
|
||||
"max_tokens": 4096,
|
||||
},
|
||||
}
|
||||
]
|
||||
)
|
||||
data = {
|
||||
"model": "claude-3-haiku-20240307",
|
||||
"model": "claude-haiku-4-5",
|
||||
"prompt_tokens": 21,
|
||||
"completion_tokens": 20,
|
||||
"response_time_ms": 871.7040000000001,
|
||||
|
|
@ -2068,14 +2068,14 @@ def test_completion_cost_params():
|
|||
"""
|
||||
litellm.set_verbose = True
|
||||
resp1_prompt_cost, resp1_completion_cost = cost_per_token(
|
||||
model="gemini-2.0-flash",
|
||||
model="gemini-3.8-flash",
|
||||
prompt_tokens=1000,
|
||||
completion_tokens=1000,
|
||||
custom_llm_provider="vertex_ai_beta",
|
||||
)
|
||||
|
||||
resp2_prompt_cost, resp2_completion_cost = cost_per_token(
|
||||
model="gemini-2.0-flash", prompt_tokens=1000, completion_tokens=1000
|
||||
model="gemini-3.8-flash", prompt_tokens=1000, completion_tokens=1000
|
||||
)
|
||||
|
||||
assert resp2_prompt_cost > 0
|
||||
|
|
@ -2084,7 +2084,7 @@ def test_completion_cost_params():
|
|||
assert resp1_completion_cost == resp2_completion_cost
|
||||
|
||||
resp3_prompt_cost, resp3_completion_cost = cost_per_token(
|
||||
model="vertex_ai/gemini-2.0-flash", prompt_tokens=1000, completion_tokens=1000
|
||||
model="vertex_ai/gemini-3.8-flash", prompt_tokens=1000, completion_tokens=1000
|
||||
)
|
||||
|
||||
assert resp3_prompt_cost > 0
|
||||
|
|
@ -2102,14 +2102,14 @@ def test_completion_cost_params_2():
|
|||
prompt_tokens = 1000
|
||||
completion_tokens = 1000
|
||||
resp1_prompt_cost, resp1_completion_cost = cost_per_token(
|
||||
model="gemini-2.0-flash",
|
||||
model="gemini-3.8-flash",
|
||||
prompt_tokens=prompt_tokens,
|
||||
completion_tokens=completion_tokens,
|
||||
)
|
||||
|
||||
print(resp1_prompt_cost, resp1_completion_cost)
|
||||
|
||||
model_info = litellm.get_model_info("gemini-2.0-flash")
|
||||
model_info = litellm.get_model_info("gemini-3.8-flash")
|
||||
input_cost_per_token = model_info["input_cost_per_token"]
|
||||
output_cost_per_token = model_info["output_cost_per_token"]
|
||||
|
||||
|
|
@ -2148,7 +2148,7 @@ def test_completion_cost_params_gemini_3():
|
|||
)
|
||||
],
|
||||
created=1728529259,
|
||||
model="gemini-2.0-flash",
|
||||
model="gemini-3.8-flash",
|
||||
object="chat.completion",
|
||||
system_fingerprint=None,
|
||||
usage=usage,
|
||||
|
|
@ -2172,7 +2172,7 @@ def test_completion_cost_params_gemini_3():
|
|||
|
||||
pc, cc = cost_per_character(
|
||||
**{
|
||||
"model": "gemini-2.0-flash",
|
||||
"model": "gemini-3.8-flash",
|
||||
"custom_llm_provider": "vertex_ai",
|
||||
"prompt_characters": None,
|
||||
"completion_characters": 3,
|
||||
|
|
@ -2180,9 +2180,9 @@ def test_completion_cost_params_gemini_3():
|
|||
}
|
||||
)
|
||||
|
||||
model_info = litellm.get_model_info("gemini-2.0-flash")
|
||||
model_info = litellm.get_model_info("gemini-3.8-flash")
|
||||
|
||||
# gemini-2.0-flash has no per-character pricing, so cost_per_character
|
||||
# gemini-3.8-flash has no per-character pricing, so cost_per_character
|
||||
# falls back to per-token pricing using usage.prompt_tokens / usage.completion_tokens
|
||||
assert round(pc, 10) == round(3771 * model_info["input_cost_per_token"], 10)
|
||||
assert round(cc, 10) == round(
|
||||
|
|
@ -2239,16 +2239,16 @@ async def test_test_completion_cost_gpt4o_audio_output_from_model(stream):
|
|||
)
|
||||
],
|
||||
created=1729282652,
|
||||
model="gpt-4o-audio-preview",
|
||||
model="gpt-audio-1.5",
|
||||
object="chat.completion",
|
||||
system_fingerprint="fp_4eafc16e9d",
|
||||
usage=usage_object,
|
||||
service_tier=None,
|
||||
)
|
||||
|
||||
cost = completion_cost(completion, model="gpt-4o-audio-preview")
|
||||
cost = completion_cost(completion, model="gpt-audio-1.5")
|
||||
|
||||
model_info = litellm.get_model_info("gpt-4o-audio-preview")
|
||||
model_info = litellm.get_model_info("gpt-audio-1.5")
|
||||
print(f"model_info: {model_info}")
|
||||
## input cost
|
||||
|
||||
|
|
@ -2517,7 +2517,7 @@ def test_cost_calculator_with_base_model():
|
|||
resp = litellm.completion(
|
||||
model="bedrock/random-model",
|
||||
messages=[{"role": "user", "content": "Hello, how are you?"}],
|
||||
base_model="bedrock/anthropic.claude-3-sonnet-20240229-v1:0",
|
||||
base_model="bedrock/anthropic.claude-sonnet-5",
|
||||
mock_response="Hello, how are you?",
|
||||
)
|
||||
assert resp.model == "random-model"
|
||||
|
|
@ -2551,10 +2551,10 @@ def test_cost_calculator_with_base_model_with_router(base_model_arg):
|
|||
if base_model_arg == "litellm_param":
|
||||
model_item["litellm_params"][
|
||||
"base_model"
|
||||
] = "bedrock/anthropic.claude-3-sonnet-20240229-v1:0"
|
||||
] = "bedrock/anthropic.claude-sonnet-5"
|
||||
elif base_model_arg == "model_info":
|
||||
model_item["model_info"] = {
|
||||
"base_model": "bedrock/anthropic.claude-3-sonnet-20240229-v1:0",
|
||||
"base_model": "bedrock/anthropic.claude-sonnet-5",
|
||||
}
|
||||
|
||||
router = Router(model_list=[model_item])
|
||||
|
|
|
|||
|
|
@ -1148,7 +1148,7 @@ def test_openai_gateway_timeout_error():
|
|||
@pytest.mark.parametrize(
|
||||
"provider, model, call_type",
|
||||
[
|
||||
("anthropic", "claude-3-haiku-20240307", "chat_completion"),
|
||||
("anthropic", "claude-haiku-4-5-20251001", "chat_completion"),
|
||||
],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ def trade(model_name: str) -> List[Trade]: # type: ignore
|
|||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"model", ["claude-haiku-4-5-20251001", "anthropic.claude-3-haiku-20240307-v1:0"]
|
||||
"model", ["claude-haiku-4-5-20251001", "us.anthropic.claude-haiku-4-5-20251001-v1:0"]
|
||||
)
|
||||
@pytest.mark.flaky(retries=6, delay=10)
|
||||
def test_function_call_parsing(model):
|
||||
|
|
|
|||
|
|
@ -67,7 +67,17 @@ def test_get_llm_provider_deepseek_custom_api_base():
|
|||
os.environ.pop("DEEPSEEK_API_BASE")
|
||||
|
||||
|
||||
def test_get_llm_provider_vertex_ai_image_models():
|
||||
def test_get_llm_provider_vertex_ai_image_models(monkeypatch):
|
||||
monkeypatch.setattr(litellm, "vertex_ai_image_models", set())
|
||||
monkeypatch.setattr(litellm, "models_by_provider", dict(litellm.models_by_provider))
|
||||
litellm.add_known_models(
|
||||
model_cost_map={
|
||||
"vertex_ai/imagegeneration@006": {
|
||||
"litellm_provider": "vertex_ai-image-models",
|
||||
"mode": "image_generation",
|
||||
}
|
||||
}
|
||||
)
|
||||
model, custom_llm_provider, dynamic_api_key, api_base = litellm.get_llm_provider(
|
||||
model="imagegeneration@006", custom_llm_provider=None
|
||||
)
|
||||
|
|
@ -101,17 +111,17 @@ def test_get_llm_provider_ai21_chat_test2():
|
|||
|
||||
def test_get_llm_provider_cohere_chat_test2():
|
||||
"""
|
||||
if user prefix with cohere/ but calls command-r-plus then it should be cohere_chat provider
|
||||
if user prefix with cohere/ but calls command-r-plus-08-2024 then it should be cohere_chat provider
|
||||
"""
|
||||
model, custom_llm_provider, dynamic_api_key, api_base = litellm.get_llm_provider(
|
||||
model="cohere/command-r-plus",
|
||||
model="cohere/command-r-plus-08-2024",
|
||||
)
|
||||
|
||||
print("model=", model)
|
||||
print("custom_llm_provider=", custom_llm_provider)
|
||||
print("api_base=", api_base)
|
||||
assert custom_llm_provider == "cohere_chat"
|
||||
assert model == "command-r-plus"
|
||||
assert model == "command-r-plus-08-2024"
|
||||
|
||||
|
||||
def test_get_llm_provider_azure_o1():
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ def test_get_model_info_simple_model_name():
|
|||
"""
|
||||
tests if model name given, and model exists in model info - the object is returned
|
||||
"""
|
||||
model = "claude-3-opus-20240229"
|
||||
model = "claude-opus-5-5"
|
||||
litellm.get_model_info(model)
|
||||
|
||||
|
||||
|
|
@ -24,7 +24,7 @@ def test_get_model_info_custom_llm_with_model_name():
|
|||
"""
|
||||
Tests if {custom_llm_provider}/{model_name} name given, and model exists in model info, the object is returned
|
||||
"""
|
||||
model = "anthropic/claude-3-opus-20240229"
|
||||
model = "anthropic/claude-opus-5-5"
|
||||
litellm.get_model_info(model)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ async def test_get_available_deployments():
|
|||
},
|
||||
{
|
||||
"model_name": "gpt-3.5-turbo",
|
||||
"litellm_params": {"model": "groq/llama-3.1-8b-instant"},
|
||||
"litellm_params": {"model": "groq/openai/gpt-oss-20b"},
|
||||
"model_info": {"id": "groq-llama"},
|
||||
},
|
||||
]
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ async def test_openai_moderation_error_raising(monkeypatch):
|
|||
from unittest.mock import AsyncMock, MagicMock
|
||||
from litellm.types.llms.openai import OpenAIModerationResponse
|
||||
|
||||
litellm.openai_moderations_model_name = "text-moderation-latest"
|
||||
litellm.openai_moderations_model_name = "omni-moderation-latest"
|
||||
openai_mod = _ENTERPRISE_OpenAI_Moderation()
|
||||
_api_key = "sk-12345"
|
||||
_api_key = hash_token("sk-12345")
|
||||
|
|
@ -41,9 +41,9 @@ async def test_openai_moderation_error_raising(monkeypatch):
|
|||
llm_router = litellm.Router(
|
||||
model_list=[
|
||||
{
|
||||
"model_name": "text-moderation-latest",
|
||||
"model_name": "omni-moderation-latest",
|
||||
"litellm_params": {
|
||||
"model": "text-moderation-latest",
|
||||
"model": "omni-moderation-latest",
|
||||
"api_key": os.environ.get("OPENAI_API_KEY", "fake-key"),
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ def test_router_get_model_info_wildcard_routes():
|
|||
]
|
||||
)
|
||||
model_info = router.get_router_model_info(
|
||||
deployment=None, received_model_name="gemini/gemini-1.5-flash", id="1"
|
||||
deployment=None, received_model_name="gemini/gemini-2.5-flash", id="1"
|
||||
)
|
||||
print(model_info)
|
||||
assert model_info is not None
|
||||
|
|
@ -212,7 +212,7 @@ async def test_router_get_model_group_usage_wildcard_routes():
|
|||
)
|
||||
|
||||
resp = await router.acompletion(
|
||||
model="gemini/gemini-1.5-flash",
|
||||
model="gemini/gemini-2.5-flash",
|
||||
messages=[{"role": "user", "content": "Hello, how are you?"}],
|
||||
mock_response="Hello, I'm good.",
|
||||
)
|
||||
|
|
@ -220,7 +220,7 @@ async def test_router_get_model_group_usage_wildcard_routes():
|
|||
|
||||
await asyncio.sleep(2)
|
||||
|
||||
tpm, rpm = await router.get_model_group_usage(model_group="gemini/gemini-1.5-flash")
|
||||
tpm, rpm = await router.get_model_group_usage(model_group="gemini/gemini-2.5-flash")
|
||||
|
||||
assert tpm is not None, "tpm is None"
|
||||
assert rpm is not None, "rpm is None"
|
||||
|
|
@ -242,7 +242,7 @@ async def test_call_router_callbacks_on_success():
|
|||
router.cache, "async_increment_cache_pipeline", new=AsyncMock()
|
||||
) as mock_callback:
|
||||
await router.acompletion(
|
||||
model="gemini/gemini-1.5-flash",
|
||||
model="gemini/gemini-2.5-flash",
|
||||
messages=[{"role": "user", "content": "Hello, how are you?"}],
|
||||
mock_response="Hello, I'm good.",
|
||||
)
|
||||
|
|
@ -255,12 +255,12 @@ async def test_call_router_callbacks_on_success():
|
|||
for increment in increment_list:
|
||||
if "tpm" in increment["key"]:
|
||||
assert increment["key"].startswith(
|
||||
"global_router:1:gemini/gemini-1.5-flash:tpm"
|
||||
"global_router:1:gemini/gemini-2.5-flash:tpm"
|
||||
)
|
||||
assert increment["increment_value"] == 30
|
||||
elif "rpm" in increment["key"]:
|
||||
assert increment["key"].startswith(
|
||||
"global_router:1:gemini/gemini-1.5-flash:rpm"
|
||||
"global_router:1:gemini/gemini-2.5-flash:rpm"
|
||||
)
|
||||
assert increment["increment_value"] == 1
|
||||
|
||||
|
|
@ -283,7 +283,7 @@ async def test_call_router_callbacks_on_failure():
|
|||
) as mock_callback:
|
||||
with pytest.raises(litellm.RateLimitError):
|
||||
await router.acompletion(
|
||||
model="gemini/gemini-1.5-flash",
|
||||
model="gemini/gemini-2.5-flash",
|
||||
messages=[{"role": "user", "content": "Hello, how are you?"}],
|
||||
mock_response="litellm.RateLimitError",
|
||||
num_retries=0,
|
||||
|
|
@ -295,7 +295,7 @@ async def test_call_router_callbacks_on_failure():
|
|||
assert (
|
||||
mock_callback.call_args_list[0]
|
||||
.kwargs["key"]
|
||||
.startswith("global_router:1:gemini/gemini-1.5-flash:rpm")
|
||||
.startswith("global_router:1:gemini/gemini-2.5-flash:rpm")
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -317,7 +317,7 @@ async def test_router_model_group_headers():
|
|||
|
||||
for _ in range(2):
|
||||
resp = await router.acompletion(
|
||||
model="gemini/gemini-1.5-flash",
|
||||
model="gemini/gemini-2.5-flash",
|
||||
messages=[{"role": "user", "content": "Hello, how are you?"}],
|
||||
mock_response="Hello, I'm good.",
|
||||
)
|
||||
|
|
@ -325,7 +325,7 @@ async def test_router_model_group_headers():
|
|||
|
||||
assert (
|
||||
resp._hidden_params["additional_headers"]["x-litellm-model-group"]
|
||||
== "gemini/gemini-1.5-flash"
|
||||
== "gemini/gemini-2.5-flash"
|
||||
)
|
||||
|
||||
assert "x-ratelimit-remaining-requests" in resp._hidden_params["additional_headers"]
|
||||
|
|
@ -349,7 +349,7 @@ async def test_get_remaining_model_group_usage():
|
|||
)
|
||||
for _ in range(2):
|
||||
resp = await router.acompletion(
|
||||
model="gemini/gemini-1.5-flash",
|
||||
model="gemini/gemini-2.5-flash",
|
||||
messages=[{"role": "user", "content": "Hello, how are you?"}],
|
||||
mock_response="Hello, I'm good.",
|
||||
)
|
||||
|
|
@ -363,7 +363,7 @@ async def test_get_remaining_model_group_usage():
|
|||
await asyncio.sleep(1)
|
||||
|
||||
remaining_usage = await router.get_remaining_model_group_usage(
|
||||
model_group="gemini/gemini-1.5-flash"
|
||||
model_group="gemini/gemini-2.5-flash"
|
||||
)
|
||||
assert remaining_usage is not None
|
||||
assert "x-ratelimit-remaining-requests" in remaining_usage
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ async def test_spend_calc_model_on_router_messages():
|
|||
{
|
||||
"model_name": "special-llama-model",
|
||||
"litellm_params": {
|
||||
"model": "groq/llama-3.1-8b-instant",
|
||||
"model": "groq/openai/gpt-oss-20b",
|
||||
},
|
||||
}
|
||||
]
|
||||
|
|
@ -81,7 +81,7 @@ async def test_spend_calc_using_response():
|
|||
}
|
||||
],
|
||||
"created": "1677652288",
|
||||
"model": "groq/llama-3.1-8b-instant",
|
||||
"model": "groq/openai/gpt-oss-20b",
|
||||
"object": "chat.completion",
|
||||
"system_fingerprint": "fp_873a560973",
|
||||
"usage": {
|
||||
|
|
|
|||
|
|
@ -31,14 +31,14 @@
|
|||
"model_id": null,
|
||||
"cache_key": null,
|
||||
"api_base": null,
|
||||
"response_cost": 7.5e-06,
|
||||
"response_cost": 3.5e-05,
|
||||
"additional_headers": {},
|
||||
"litellm_overhead_time_ms": null,
|
||||
"batch_models": null,
|
||||
"litellm_model_name": "vertex_ai/gemini-2.0-flash-001",
|
||||
"litellm_model_name": "vertex_ai/gemini-3-flash-preview",
|
||||
"usage_object": null
|
||||
},
|
||||
"litellm_response_cost": 7.5e-06,
|
||||
"litellm_response_cost": 3.5e-05,
|
||||
"cache_hit": false,
|
||||
"requester_metadata": {}
|
||||
},
|
||||
|
|
@ -54,13 +54,13 @@
|
|||
"id": "time-14-15-40-349639_chatcmpl-59a988d0-7ef1-4dc4-bc18-d2e78961817f",
|
||||
"endTime": "2025-05-26T14:15:40.607266-07:00",
|
||||
"completionStartTime": "2025-05-26T14:15:40.607266-07:00",
|
||||
"model": "gemini-2.0-flash-001",
|
||||
"model": "gemini-3-flash-preview",
|
||||
"modelParameters": {},
|
||||
"usage": {
|
||||
"input": 10,
|
||||
"output": 10,
|
||||
"unit": "TOKENS",
|
||||
"totalCost": 7.5e-06
|
||||
"totalCost": 3.5e-05
|
||||
},
|
||||
"usageDetails": {
|
||||
"input": 10,
|
||||
|
|
|
|||
|
|
@ -582,7 +582,7 @@ async def test_webhook_alerting(alerting_type):
|
|||
None,
|
||||
None,
|
||||
),
|
||||
("gemini-2.0-flash", None, "vertex_ai", "hardy-device-38811", "us-central1"),
|
||||
("gemini-3.8-flash", None, "vertex_ai", "hardy-device-38811", "us-central1"),
|
||||
],
|
||||
)
|
||||
@pytest.mark.parametrize("error_code", [500, 408, 400])
|
||||
|
|
@ -688,7 +688,7 @@ async def test_outage_alerting_called(
|
|||
None,
|
||||
None,
|
||||
),
|
||||
("gemini-2.0-flash", None, "vertex_ai", "hardy-device-38811", "us-central1"),
|
||||
("gemini-3.8-flash", None, "vertex_ai", "hardy-device-38811", "us-central1"),
|
||||
],
|
||||
)
|
||||
@pytest.mark.parametrize("error_code", [500, 408, 400])
|
||||
|
|
@ -775,7 +775,7 @@ async def test_region_outage_alerting_called(
|
|||
await slack_alerting.region_outage_alerts(
|
||||
exception=error_to_raise, deployment_id=deployment_id # type: ignore
|
||||
)
|
||||
if model == "gemini-2.0-flash" and (error_code == 500 or error_code == 408):
|
||||
if model == "gemini-3.8-flash" and (error_code == 500 or error_code == 408):
|
||||
mock_send_alert.assert_called_once()
|
||||
else:
|
||||
mock_send_alert.assert_not_called()
|
||||
|
|
|
|||
|
|
@ -481,12 +481,12 @@ class TestLangfuseLogging:
|
|||
completion_tokens=10,
|
||||
total_tokens=20,
|
||||
),
|
||||
model="vertex/gemini-2.0-flash-001",
|
||||
model="vertex/gemini-3-flash-preview",
|
||||
object="chat.completion",
|
||||
created=1723081200,
|
||||
).model_dump()
|
||||
await litellm.acompletion(
|
||||
model="vertex_ai/gemini-2.0-flash-001",
|
||||
model="vertex_ai/gemini-3-flash-preview",
|
||||
messages=[{"role": "user", "content": "Hello!"}],
|
||||
mock_response=mock_response,
|
||||
metadata={"trace_id": setup["trace_id"]},
|
||||
|
|
|
|||
|
|
@ -2120,6 +2120,7 @@ class TestPrismaTableRepository:
|
|||
"litellm_prompttable",
|
||||
"litellm_searchtoolstable",
|
||||
"litellm_ssoconfig",
|
||||
"litellm_uisettings",
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue