The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
Lazy load OpenAILikeChatConfig to avoid heavy import (#18075)
Alexsander Hamir233e89976a1f
diff --git a/litellm/__init__.py b/litellm/__init__.pyindex 98e5a34bd6a..e1719f13263 100644--- a/litellm/__init__.py+++ b/litellm/__init__.py@@ -1056,7 +1056,6 @@ from .utils import clientfrom .llms.bytez.chat.transformation import BytezChatConfigfrom .llms.custom_llm import CustomLLM-from .llms.openai_like.chat.handler import OpenAILikeChatConfigfrom .llms.aiohttp_openai.chat.transformation import AiohttpOpenAIChatConfigfrom .llms.galadriel.chat.transformation import GaladrielChatConfigfrom .llms.github.chat.transformation import GithubChatConfig@@ -1554,6 +1553,7 @@ if TYPE_CHECKING:# LLM config classes - lazy loaded onlyAmazonConverseConfig: Type[Any]+ OpenAILikeChatConfig: Type[Any]def __getattr__(name: str) -> Any:diff --git a/litellm/_lazy_imports.py b/litellm/_lazy_imports.pyindex 9da861a1028..94b3e4a8da1 100644--- a/litellm/_lazy_imports.py+++ b/litellm/_lazy_imports.py@@ -157,6 +157,7 @@ DOTPROMPT_NAMES = (# LLM config classes that support lazy loading via _lazy_import_llm_configsLLM_CONFIG_NAMES = ("AmazonConverseConfig",+ "OpenAILikeChatConfig",)# Types that support lazy loading via _lazy_import_types@@ -651,4 +652,12 @@ def _lazy_import_llm_configs(name: str) -> Any:_globals["AmazonConverseConfig"] = _AmazonConverseConfigreturn _AmazonConverseConfig+ if name == "OpenAILikeChatConfig":+ from .llms.openai_like.chat.handler import (+ OpenAILikeChatConfig as _OpenAILikeChatConfig,+ )++ _globals["OpenAILikeChatConfig"] = _OpenAILikeChatConfig+ return _OpenAILikeChatConfig+raise AttributeError(f"LLM config lazy import: unknown attribute {name!r}")\ No newline at end of file