From 36e99ebce72c1866c77a42553aabc79ebf98b005 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Sat, 7 Dec 2024 22:01:00 -0800 Subject: [PATCH] fix use consistent naming (#7092) --- litellm/__init__.py | 6 +++--- litellm/assistants/main.py | 4 ++-- litellm/batches/main.py | 2 +- litellm/cost_calculator.py | 6 +++--- litellm/llms/{AzureOpenAI => azure}/assistants.py | 0 litellm/llms/{AzureOpenAI => azure}/audio_transcriptions.py | 0 litellm/llms/{AzureOpenAI => azure}/azure.py | 0 .../llms/{AzureOpenAI => azure}/chat/gpt_transformation.py | 0 litellm/llms/{AzureOpenAI => azure}/chat/o1_handler.py | 0 .../llms/{AzureOpenAI => azure}/chat/o1_transformation.py | 0 litellm/llms/{AzureOpenAI => azure}/common_utils.py | 0 litellm/llms/{AzureOpenAI => azure}/cost_calculation.py | 0 litellm/llms/{AzureOpenAI => azure}/realtime/handler.py | 0 litellm/main.py | 6 +++--- litellm/realtime_api/main.py | 2 +- litellm/router.py | 2 +- litellm/router_utils/client_initalization_utils.py | 4 ++-- tests/llm_translation/test_azure_openai.py | 4 ++-- tests/llm_translation/test_max_completion_tokens.py | 2 +- tests/local_testing/test_secret_manager.py | 2 +- 20 files changed, 20 insertions(+), 20 deletions(-) rename litellm/llms/{AzureOpenAI => azure}/assistants.py (100%) rename litellm/llms/{AzureOpenAI => azure}/audio_transcriptions.py (100%) rename litellm/llms/{AzureOpenAI => azure}/azure.py (100%) rename litellm/llms/{AzureOpenAI => azure}/chat/gpt_transformation.py (100%) rename litellm/llms/{AzureOpenAI => azure}/chat/o1_handler.py (100%) rename litellm/llms/{AzureOpenAI => azure}/chat/o1_transformation.py (100%) rename litellm/llms/{AzureOpenAI => azure}/common_utils.py (100%) rename litellm/llms/{AzureOpenAI => azure}/cost_calculation.py (100%) rename litellm/llms/{AzureOpenAI => azure}/realtime/handler.py (100%) diff --git a/litellm/__init__.py b/litellm/__init__.py index 8101e1a499..542ab89c91 100644 --- a/litellm/__init__.py +++ b/litellm/__init__.py @@ -1167,18 +1167,18 @@ from .llms.jina_ai.embedding.transformation import JinaAIEmbeddingConfig from .llms.xai.chat.xai_transformation import XAIChatConfig from .llms.volcengine import VolcEngineConfig from .llms.text_completion_codestral import MistralTextCompletionConfig -from .llms.AzureOpenAI.azure import ( +from .llms.azure.azure import ( AzureOpenAIError, AzureOpenAIAssistantsAPIConfig, ) -from .llms.AzureOpenAI.chat.gpt_transformation import AzureOpenAIConfig +from .llms.azure.chat.gpt_transformation import AzureOpenAIConfig from .llms.hosted_vllm.chat.transformation import HostedVLLMChatConfig from .llms.deepseek.chat.transformation import DeepSeekChatConfig from .llms.lm_studio.chat.transformation import LMStudioChatConfig from .llms.lm_studio.embed.transformation import LmStudioEmbeddingConfig from .llms.perplexity.chat.transformation import PerplexityChatConfig -from .llms.AzureOpenAI.chat.o1_transformation import AzureOpenAIO1Config +from .llms.azure.chat.o1_transformation import AzureOpenAIO1Config from .llms.watsonx.completion.handler import IBMWatsonXAIConfig from .llms.watsonx.chat.transformation import IBMWatsonXChatConfig from .main import * # type: ignore diff --git a/litellm/assistants/main.py b/litellm/assistants/main.py index d9b4b648fe..4c71554fa2 100644 --- a/litellm/assistants/main.py +++ b/litellm/assistants/main.py @@ -12,7 +12,7 @@ from openai.types.beta.assistant import Assistant from openai.types.beta.assistant_deleted import AssistantDeleted import litellm -from litellm.llms.AzureOpenAI import assistants +from litellm.llms.azure import assistants from litellm.types.router import GenericLiteLLMParams from litellm.utils import ( exception_type, @@ -21,7 +21,7 @@ from litellm.utils import ( supports_httpx_timeout, ) -from ..llms.AzureOpenAI.assistants import AzureAssistantsAPI +from ..llms.azure.assistants import AzureAssistantsAPI from ..llms.OpenAI.openai import OpenAIAssistantsAPI from ..types.llms.openai import * from ..types.router import * diff --git a/litellm/batches/main.py b/litellm/batches/main.py index 4d04068a26..af44924801 100644 --- a/litellm/batches/main.py +++ b/litellm/batches/main.py @@ -20,7 +20,7 @@ import httpx import litellm from litellm import client -from litellm.llms.AzureOpenAI.azure import AzureBatchesAPI +from litellm.llms.azure.azure import AzureBatchesAPI from litellm.llms.OpenAI.openai import OpenAIBatchesAPI from litellm.llms.vertex_ai_and_google_ai_studio.batches.handler import ( VertexAIBatchPrediction, diff --git a/litellm/cost_calculator.py b/litellm/cost_calculator.py index 9b455604d5..b9c67870e2 100644 --- a/litellm/cost_calculator.py +++ b/litellm/cost_calculator.py @@ -22,12 +22,12 @@ from litellm.litellm_core_utils.llm_cost_calc.utils import _generic_cost_per_cha from litellm.llms.anthropic.cost_calculation import ( cost_per_token as anthropic_cost_per_token, ) +from litellm.llms.azure.cost_calculation import ( + cost_per_token as azure_openai_cost_per_token, +) from litellm.llms.azure_ai.cost_calculator import ( cost_per_query as azure_ai_rerank_cost_per_query, ) -from litellm.llms.AzureOpenAI.cost_calculation import ( - cost_per_token as azure_openai_cost_per_token, -) from litellm.llms.bedrock.image.cost_calculator import ( cost_calculator as bedrock_image_cost_calculator, ) diff --git a/litellm/llms/AzureOpenAI/assistants.py b/litellm/llms/azure/assistants.py similarity index 100% rename from litellm/llms/AzureOpenAI/assistants.py rename to litellm/llms/azure/assistants.py diff --git a/litellm/llms/AzureOpenAI/audio_transcriptions.py b/litellm/llms/azure/audio_transcriptions.py similarity index 100% rename from litellm/llms/AzureOpenAI/audio_transcriptions.py rename to litellm/llms/azure/audio_transcriptions.py diff --git a/litellm/llms/AzureOpenAI/azure.py b/litellm/llms/azure/azure.py similarity index 100% rename from litellm/llms/AzureOpenAI/azure.py rename to litellm/llms/azure/azure.py diff --git a/litellm/llms/AzureOpenAI/chat/gpt_transformation.py b/litellm/llms/azure/chat/gpt_transformation.py similarity index 100% rename from litellm/llms/AzureOpenAI/chat/gpt_transformation.py rename to litellm/llms/azure/chat/gpt_transformation.py diff --git a/litellm/llms/AzureOpenAI/chat/o1_handler.py b/litellm/llms/azure/chat/o1_handler.py similarity index 100% rename from litellm/llms/AzureOpenAI/chat/o1_handler.py rename to litellm/llms/azure/chat/o1_handler.py diff --git a/litellm/llms/AzureOpenAI/chat/o1_transformation.py b/litellm/llms/azure/chat/o1_transformation.py similarity index 100% rename from litellm/llms/AzureOpenAI/chat/o1_transformation.py rename to litellm/llms/azure/chat/o1_transformation.py diff --git a/litellm/llms/AzureOpenAI/common_utils.py b/litellm/llms/azure/common_utils.py similarity index 100% rename from litellm/llms/AzureOpenAI/common_utils.py rename to litellm/llms/azure/common_utils.py diff --git a/litellm/llms/AzureOpenAI/cost_calculation.py b/litellm/llms/azure/cost_calculation.py similarity index 100% rename from litellm/llms/AzureOpenAI/cost_calculation.py rename to litellm/llms/azure/cost_calculation.py diff --git a/litellm/llms/AzureOpenAI/realtime/handler.py b/litellm/llms/azure/realtime/handler.py similarity index 100% rename from litellm/llms/AzureOpenAI/realtime/handler.py rename to litellm/llms/azure/realtime/handler.py diff --git a/litellm/main.py b/litellm/main.py index 3a8159c3f5..29ee901546 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -102,12 +102,12 @@ from .llms import ( from .llms.ai21 import completion as ai21 from .llms.anthropic.chat import AnthropicChatCompletion from .llms.anthropic.completion import AnthropicTextCompletion +from .llms.azure.audio_transcriptions import AzureAudioTranscription +from .llms.azure.azure import AzureChatCompletion, _check_dynamic_azure_params +from .llms.azure.chat.o1_handler import AzureOpenAIO1ChatCompletion from .llms.azure_ai.chat import AzureAIChatCompletion from .llms.azure_ai.embed import AzureAIEmbedding from .llms.azure_text import AzureTextCompletion -from .llms.AzureOpenAI.audio_transcriptions import AzureAudioTranscription -from .llms.AzureOpenAI.azure import AzureChatCompletion, _check_dynamic_azure_params -from .llms.AzureOpenAI.chat.o1_handler import AzureOpenAIO1ChatCompletion from .llms.bedrock.chat import BedrockConverseLLM, BedrockLLM from .llms.bedrock.embed.embedding import BedrockEmbedding from .llms.bedrock.image.image_handler import BedrockImageGeneration diff --git a/litellm/realtime_api/main.py b/litellm/realtime_api/main.py index 9088a491c0..b17662c62c 100644 --- a/litellm/realtime_api/main.py +++ b/litellm/realtime_api/main.py @@ -9,7 +9,7 @@ from litellm.secret_managers.main import get_secret_str from litellm.types.router import GenericLiteLLMParams from ..litellm_core_utils.litellm_logging import Logging as LiteLLMLogging -from ..llms.AzureOpenAI.realtime.handler import AzureOpenAIRealtime +from ..llms.azure.realtime.handler import AzureOpenAIRealtime from ..llms.OpenAI.realtime.handler import OpenAIRealtime from ..utils import client as wrapper_client diff --git a/litellm/router.py b/litellm/router.py index 34143bd500..c9cfab5556 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -54,7 +54,7 @@ from litellm.caching.caching import DualCache, InMemoryCache, RedisCache from litellm.integrations.custom_logger import CustomLogger from litellm.litellm_core_utils.core_helpers import _get_parent_otel_span_from_kwargs from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLogging -from litellm.llms.AzureOpenAI.azure import get_azure_ad_token_from_oidc +from litellm.llms.azure.azure import get_azure_ad_token_from_oidc from litellm.router_strategy.least_busy import LeastBusyLoggingHandler from litellm.router_strategy.lowest_cost import LowestCostLoggingHandler from litellm.router_strategy.lowest_latency import LowestLatencyLoggingHandler diff --git a/litellm/router_utils/client_initalization_utils.py b/litellm/router_utils/client_initalization_utils.py index db8f20ee6b..8a11edce8f 100644 --- a/litellm/router_utils/client_initalization_utils.py +++ b/litellm/router_utils/client_initalization_utils.py @@ -9,7 +9,7 @@ import openai import litellm from litellm import get_secret, get_secret_str from litellm._logging import verbose_router_logger -from litellm.llms.AzureOpenAI.azure import get_azure_ad_token_from_oidc +from litellm.llms.azure.azure import get_azure_ad_token_from_oidc from litellm.secret_managers.get_azure_ad_token_provider import ( get_azure_ad_token_provider, ) @@ -359,7 +359,7 @@ class InitalizeOpenAISDKClient: azure_client_params["azure_ad_token_provider"] = ( azure_ad_token_provider ) - from litellm.llms.AzureOpenAI.azure import ( + from litellm.llms.azure.azure import ( select_azure_base_url_or_endpoint, ) diff --git a/tests/llm_translation/test_azure_openai.py b/tests/llm_translation/test_azure_openai.py index 837714770f..9bf16a5cf5 100644 --- a/tests/llm_translation/test_azure_openai.py +++ b/tests/llm_translation/test_azure_openai.py @@ -6,7 +6,7 @@ sys.path.insert( ) # Adds the parent directory to the system path import pytest -from litellm.llms.AzureOpenAI.common_utils import process_azure_headers +from litellm.llms.azure.common_utils import process_azure_headers from httpx import Headers @@ -172,7 +172,7 @@ def test_azure_extra_headers(input, call_type): ], ) def test_process_azure_endpoint_url(api_base, model, expected_endpoint): - from litellm.llms.AzureOpenAI.azure import AzureChatCompletion + from litellm.llms.azure.azure import AzureChatCompletion azure_chat_completion = AzureChatCompletion() input_args = { diff --git a/tests/llm_translation/test_max_completion_tokens.py b/tests/llm_translation/test_max_completion_tokens.py index 03eb638757..363125a603 100644 --- a/tests/llm_translation/test_max_completion_tokens.py +++ b/tests/llm_translation/test_max_completion_tokens.py @@ -231,7 +231,7 @@ def test_all_model_configs(): optional_params={}, ) == {"max_tokens": 10} - from litellm.llms.AzureOpenAI.chat.gpt_transformation import AzureOpenAIConfig + from litellm.llms.azure.chat.gpt_transformation import AzureOpenAIConfig assert "max_completion_tokens" in AzureOpenAIConfig().get_supported_openai_params() assert AzureOpenAIConfig().map_openai_params( diff --git a/tests/local_testing/test_secret_manager.py b/tests/local_testing/test_secret_manager.py index 1b95119a31..66f63809d9 100644 --- a/tests/local_testing/test_secret_manager.py +++ b/tests/local_testing/test_secret_manager.py @@ -16,7 +16,7 @@ sys.path.insert( ) # Adds the parent directory to the system path import pytest import litellm -from litellm.llms.AzureOpenAI.azure import get_azure_ad_token_from_oidc +from litellm.llms.azure.azure import get_azure_ad_token_from_oidc from litellm.llms.bedrock.chat import BedrockConverseLLM, BedrockLLM from litellm.secret_managers.aws_secret_manager_v2 import AWSSecretsManagerV2 from litellm.secret_managers.main import (