Skip to content

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]

Add lazy loading for GaladrielChatConfig to reduce import memory overhead (#18260)

Alexsander Hamirf3b97356fb28
diff --git a/litellm/__init__.py b/litellm/__init__.py
index 9b69beccd79..0463282c089 100644
--- a/litellm/__init__.py
+++ b/litellm/__init__.py
@@ -1066,7 +1066,6 @@ from .utils import client
from .llms.bytez.chat.transformation import BytezChatConfig
from .llms.custom_llm import CustomLLM
from .llms.aiohttp_openai.chat.transformation import AiohttpOpenAIChatConfig
-from .llms.galadriel.chat.transformation import GaladrielChatConfig
from .llms.github.chat.transformation import GithubChatConfig
from .llms.compactifai.chat.transformation import CompactifAIChatConfig
from .llms.empower.chat.transformation import EmpowerChatConfig
diff --git a/litellm/_lazy_imports.py b/litellm/_lazy_imports.py
index 94b3e4a8da1..14772862686 100644
--- a/litellm/_lazy_imports.py
+++ b/litellm/_lazy_imports.py
@@ -158,6 +158,7 @@ DOTPROMPT_NAMES = (
LLM_CONFIG_NAMES = (
"AmazonConverseConfig",
"OpenAILikeChatConfig",
+ "GaladrielChatConfig",
)
# Types that support lazy loading via _lazy_import_types
@@ -660,4 +661,12 @@ def _lazy_import_llm_configs(name: str) -> Any:
_globals["OpenAILikeChatConfig"] = _OpenAILikeChatConfig
return _OpenAILikeChatConfig
+ if name == "GaladrielChatConfig":
+ from .llms.galadriel.chat.transformation import (
+ GaladrielChatConfig as _GaladrielChatConfig,
+ )
+
+ _globals["GaladrielChatConfig"] = _GaladrielChatConfig
+ return _GaladrielChatConfig
+
raise AttributeError(f"LLM config lazy import: unknown attribute {name!r}")
\ No newline at end of file