mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-06 02:48:13 +00:00
refactor: lazy load litellm_core_utils & change bad import patterm
This commit is contained in:
parent
7d81d245fb
commit
914c1068a4
2 changed files with 4 additions and 2 deletions
|
|
@ -1057,8 +1057,6 @@ openai_image_generation_models = ["dall-e-2", "dall-e-3"]
|
|||
openai_video_generation_models = ["sora-2"]
|
||||
|
||||
# timeout is lazy-loaded via __getattr__
|
||||
# get_llm_provider is lazy-loaded via __getattr__
|
||||
# remove_index_from_tool_calls is lazy-loaded via __getattr__
|
||||
|
||||
# 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)
|
||||
|
|
@ -1507,6 +1505,7 @@ 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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -336,6 +337,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 = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue