Litellm merge pr (#7161)

* build: merge branch

* test: fix openai naming

* fix(main.py): fix openai renaming

* style: ignore function length for config factory

* fix(sagemaker/): fix routing logic

* fix: fix imports

* fix: fix override
This commit is contained in:
Krish Dholakia 2024-12-10 22:49:26 -08:00 committed by GitHub
parent d5aae81c6d
commit 350cfc36f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
88 changed files with 3617 additions and 4421 deletions

View file

@ -290,35 +290,46 @@ async def test_add_and_delete_deployments(llm_router, model_list_flag_value):
assert len(llm_router.model_list) == len(model_list) + prev_llm_router_val
def test_provider_config_manager():
from litellm import LITELLM_CHAT_PROVIDERS, LlmProviders
from litellm.utils import ProviderConfigManager
from litellm.llms.base_llm.transformation import BaseConfig
from litellm.llms.openai.chat.gpt_transformation import OpenAIGPTConfig
from litellm import LITELLM_CHAT_PROVIDERS, LlmProviders
from litellm.utils import ProviderConfigManager
from litellm.llms.base_llm.transformation import BaseConfig
for provider in LITELLM_CHAT_PROVIDERS:
if provider == LlmProviders.TRITON or provider == LlmProviders.PREDIBASE:
continue
assert isinstance(
ProviderConfigManager.get_provider_chat_config(
model="gpt-3.5-turbo", provider=LlmProviders(provider)
),
BaseConfig,
), f"Provider {provider} is not a subclass of BaseConfig"
config = ProviderConfigManager.get_provider_chat_config(
model="gpt-3.5-turbo", provider=LlmProviders(provider)
)
if (
provider != litellm.LlmProviders.OPENAI
and provider != litellm.LlmProviders.OPENAI_LIKE
and provider != litellm.LlmProviders.CUSTOM_OPENAI
):
assert (
config.__class__.__name__ != "OpenAIGPTConfig"
), f"Provider {provider} is an instance of OpenAIGPTConfig"
def _check_provider_config(config: BaseConfig, provider: LlmProviders):
assert isinstance(
config,
BaseConfig,
), f"Provider {provider} is not a subclass of BaseConfig. Got={config}"
if (
provider != litellm.LlmProviders.OPENAI
and provider != litellm.LlmProviders.OPENAI_LIKE
and provider != litellm.LlmProviders.CUSTOM_OPENAI
):
assert (
"_abc_impl" not in config.get_config()
), f"Provider {provider} has _abc_impl"
config.__class__.__name__ != "OpenAIGPTConfig"
), f"Provider {provider} is an instance of OpenAIGPTConfig"
assert "_abc_impl" not in config.get_config(), f"Provider {provider} has _abc_impl"
# def test_provider_config_manager():
# from litellm.llms.openai.chat.gpt_transformation import OpenAIGPTConfig
# for provider in LITELLM_CHAT_PROVIDERS:
# if (
# provider == LlmProviders.VERTEX_AI
# or provider == LlmProviders.VERTEX_AI_BETA
# or provider == LlmProviders.BEDROCK
# or provider == LlmProviders.BASETEN
# or provider == LlmProviders.SAGEMAKER
# or provider == LlmProviders.SAGEMAKER_CHAT
# or provider == LlmProviders.VLLM
# or provider == LlmProviders.PETALS
# or provider == LlmProviders.OLLAMA
# ):
# continue
# config = ProviderConfigManager.get_provider_chat_config(
# model="gpt-3.5-turbo", provider=LlmProviders(provider)
# )
# _check_provider_config(config, provider)