feat(azure.py): fix azure client init

This commit is contained in:
Krrish Dholakia 2025-03-11 18:05:11 -07:00
parent c5a80cc690
commit 23ca233f42
2 changed files with 11 additions and 97 deletions

View file

@ -5353,36 +5353,12 @@ class Router:
client = self.cache.get_cache(
key=cache_key, local_only=True, parent_otel_span=parent_otel_span
)
if client is None:
"""
Re-initialize the client
"""
InitalizeOpenAISDKClient.set_client(
litellm_router_instance=self, model=deployment
)
client = self.cache.get_cache(
key=cache_key,
local_only=True,
parent_otel_span=parent_otel_span,
)
return client
else:
cache_key = f"{model_id}_async_client"
client = self.cache.get_cache(
key=cache_key, local_only=True, parent_otel_span=parent_otel_span
)
# if client is None:
# """
# Re-initialize the client
# """
# InitalizeOpenAISDKClient.set_client(
# litellm_router_instance=self, model=deployment
# )
# client = self.cache.get_cache(
# key=cache_key,
# local_only=True,
# parent_otel_span=parent_otel_span,
# )
return client
else:
if kwargs.get("stream") is True:
@ -5390,32 +5366,12 @@ class Router:
client = self.cache.get_cache(
key=cache_key, parent_otel_span=parent_otel_span
)
if client is None:
"""
Re-initialize the client
"""
InitalizeOpenAISDKClient.set_client(
litellm_router_instance=self, model=deployment
)
client = self.cache.get_cache(
key=cache_key, parent_otel_span=parent_otel_span
)
return client
else:
cache_key = f"{model_id}_client"
client = self.cache.get_cache(
key=cache_key, parent_otel_span=parent_otel_span
)
if client is None:
"""
Re-initialize the client
"""
InitalizeOpenAISDKClient.set_client(
litellm_router_instance=self, model=deployment
)
client = self.cache.get_cache(
key=cache_key, parent_otel_span=parent_otel_span
)
return client
def _pre_call_checks( # noqa: PLR0915