mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-06 08:16:43 +00:00
Add lazy loading for GaladrielChatConfig to reduce import memory overhead (#18260)
Implements lazy loading pattern for GaladrielChatConfig following the existing approach used for other LLM config classes. This defers the import until the config is actually accessed, reducing memory usage during module initialization.
This commit is contained in:
parent
026c2ad693
commit
f3b97356fb
2 changed files with 9 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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}")
|
||||
Loading…
Add table
Reference in a new issue