mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
(litellm sdk - perf improvement) - use O(1) set lookups for checking llm providers / models (#7672)
* fix get model info logic to use O(1) lookups * perf - use O(1) lookup for get llm provider
This commit is contained in:
parent
b3bd15e35a
commit
c999b4efe1
4 changed files with 11 additions and 5 deletions
|
@ -133,6 +133,7 @@ from litellm.types.utils import (
|
|||
Function,
|
||||
ImageResponse,
|
||||
LlmProviders,
|
||||
LlmProvidersSet,
|
||||
Message,
|
||||
ModelInfo,
|
||||
ModelInfoBase,
|
||||
|
@ -4108,9 +4109,7 @@ def _get_model_info_helper( # noqa: PLR0915
|
|||
):
|
||||
_model_info = None
|
||||
|
||||
if custom_llm_provider and custom_llm_provider in [
|
||||
provider.value for provider in LlmProviders
|
||||
]:
|
||||
if custom_llm_provider and custom_llm_provider in LlmProvidersSet:
|
||||
# Check if the provider string exists in LlmProviders enum
|
||||
provider_config = ProviderConfigManager.get_provider_model_info(
|
||||
model=model, provider=LlmProviders(custom_llm_provider)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue