diff --git a/litellm/__init__.py b/litellm/__init__.py index 8e1d909cc12..87e191ca1b9 100644 --- a/litellm/__init__.py +++ b/litellm/__init__.py @@ -1053,8 +1053,6 @@ openai_image_generation_models = ["dall-e-2", "dall-e-3"] openai_video_generation_models = ["sora-2"] # timeout is lazy-loaded via __getattr__ -from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider -from litellm.litellm_core_utils.core_helpers import remove_index_from_tool_calls # Import KeyManagementSettings here (before utils import) because _key_management_settings # is accessed during import time in secret_managers/main.py (via dd_tracing -> datadog -> _service_logger -> utils) @@ -1503,6 +1501,8 @@ if TYPE_CHECKING: get_first_chars_messages: Callable[..., str] get_provider_fields: Callable[..., List] get_valid_models: Callable[..., list] + get_llm_provider: Callable[..., Tuple[str, str, Optional[str], Optional[str]]] + remove_index_from_tool_calls: Callable[..., None] # Response types - truly lazy loaded only (not in main.py or elsewhere) ModelResponseListIterator: Type[Any] diff --git a/litellm/_lazy_imports_registry.py b/litellm/_lazy_imports_registry.py index e2f80a14391..dfdd36af099 100644 --- a/litellm/_lazy_imports_registry.py +++ b/litellm/_lazy_imports_registry.py @@ -32,6 +32,7 @@ UTILS_NAMES = ( "ModelResponse", "ModelResponseStream", "EmbeddingResponse", "ImageResponse", "TranscriptionResponse", "TextCompletionResponse", "get_provider_fields", "ModelResponseListIterator", "get_valid_models", "timeout", + "get_llm_provider", "remove_index_from_tool_calls", ) # Token counter names that support lazy loading via _lazy_import_token_counter @@ -330,6 +331,8 @@ _UTILS_IMPORT_MAP = { "ModelResponseListIterator": (".utils", "ModelResponseListIterator"), "get_valid_models": (".utils", "get_valid_models"), "timeout": (".timeout", "timeout"), + "get_llm_provider": ("litellm.litellm_core_utils.get_llm_provider_logic", "get_llm_provider"), + "remove_index_from_tool_calls": ("litellm.litellm_core_utils.core_helpers", "remove_index_from_tool_calls"), } _COST_CALCULATOR_IMPORT_MAP = { diff --git a/litellm/realtime_api/main.py b/litellm/realtime_api/main.py index fe686598141..e26a2477b1b 100644 --- a/litellm/realtime_api/main.py +++ b/litellm/realtime_api/main.py @@ -3,7 +3,7 @@ from typing import Any, Optional, cast import litellm -from litellm import get_llm_provider +from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider from litellm.constants import REALTIME_WEBSOCKET_MAX_MESSAGE_SIZE_BYTES from litellm.llms.base_llm.realtime.transformation import BaseRealtimeConfig from litellm.llms.custom_httpx.llm_http_handler import BaseLLMHTTPHandler diff --git a/litellm/router_utils/pattern_match_deployments.py b/litellm/router_utils/pattern_match_deployments.py index c6804b1ad4c..69d6ab9b6e2 100644 --- a/litellm/router_utils/pattern_match_deployments.py +++ b/litellm/router_utils/pattern_match_deployments.py @@ -7,7 +7,7 @@ import re from re import Match from typing import Dict, List, Optional, Tuple -from litellm import get_llm_provider +from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider from litellm._logging import verbose_router_logger