fix util vertex

This commit is contained in:
Ishaan Jaff 2025-03-26 00:08:16 -07:00
parent 2bef0481af
commit 27c085cc56
2 changed files with 22 additions and 8 deletions

View file

@ -59,9 +59,7 @@ from litellm.litellm_core_utils.health_check_utils import (
_filter_model_params, _filter_model_params,
) )
from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj
from litellm.litellm_core_utils.llm_request_utils import ( from litellm.litellm_core_utils.llm_request_utils import LitellmCoreRequestUtils
pick_cheapest_chat_models_from_llm_provider,
)
from litellm.litellm_core_utils.mock_functions import ( from litellm.litellm_core_utils.mock_functions import (
mock_embedding, mock_embedding,
mock_image_generation, mock_image_generation,
@ -5424,9 +5422,11 @@ async def ahealth_check_wildcard_models(
) -> dict: ) -> dict:
# this is a wildcard model, we need to pick a random model from the provider # this is a wildcard model, we need to pick a random model from the provider
cheapest_models = pick_cheapest_chat_models_from_llm_provider( cheapest_models = (
LitellmCoreRequestUtils.pick_cheapest_chat_models_from_llm_provider(
custom_llm_provider=custom_llm_provider, n=3 custom_llm_provider=custom_llm_provider, n=3
) )
)
if len(cheapest_models) == 0: if len(cheapest_models) == 0:
raise Exception( raise Exception(
f"Unable to health check wildcard model for provider {custom_llm_provider}. Add a model on your config.yaml or contribute here - https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json" f"Unable to health check wildcard model for provider {custom_llm_provider}. Add a model on your config.yaml or contribute here - https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json"

View file

@ -1532,12 +1532,26 @@ def test_supports_vision_gemini():
def test_pick_cheapest_chat_model_from_llm_provider(): def test_pick_cheapest_chat_model_from_llm_provider():
from litellm.litellm_core_utils.llm_request_utils import ( from litellm.litellm_core_utils.llm_request_utils import (
pick_cheapest_chat_models_from_llm_provider, LitellmCoreRequestUtils,
) )
assert len(pick_cheapest_chat_models_from_llm_provider("openai", n=3)) == 3 assert (
len(
LitellmCoreRequestUtils.pick_cheapest_chat_models_from_llm_provider(
"openai", n=3
)
)
== 3
)
assert len(pick_cheapest_chat_models_from_llm_provider("unknown", n=1)) == 0 assert (
len(
LitellmCoreRequestUtils.pick_cheapest_chat_models_from_llm_provider(
"unknown", n=1
)
)
== 0
)
def test_get_potential_model_names(): def test_get_potential_model_names():