mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 11:43:54 +00:00
use ssl on initialize_azure_sdk_client
This commit is contained in:
parent
cb55069a70
commit
7bb90a15be
1 changed files with 10 additions and 2 deletions
|
@ -9,6 +9,7 @@ import litellm
|
||||||
from litellm._logging import verbose_logger
|
from litellm._logging import verbose_logger
|
||||||
from litellm.caching.caching import DualCache
|
from litellm.caching.caching import DualCache
|
||||||
from litellm.llms.base_llm.chat.transformation import BaseLLMException
|
from litellm.llms.base_llm.chat.transformation import BaseLLMException
|
||||||
|
from litellm.llms.openai.openai import OpenAIChatCompletion
|
||||||
from litellm.secret_managers.get_azure_ad_token_provider import (
|
from litellm.secret_managers.get_azure_ad_token_provider import (
|
||||||
get_azure_ad_token_provider,
|
get_azure_ad_token_provider,
|
||||||
)
|
)
|
||||||
|
@ -244,7 +245,7 @@ def select_azure_base_url_or_endpoint(azure_client_params: dict):
|
||||||
return azure_client_params
|
return azure_client_params
|
||||||
|
|
||||||
|
|
||||||
class BaseAzureLLM:
|
class BaseAzureLLM(OpenAIChatCompletion):
|
||||||
def get_azure_openai_client(
|
def get_azure_openai_client(
|
||||||
self,
|
self,
|
||||||
api_key: Optional[str],
|
api_key: Optional[str],
|
||||||
|
@ -263,6 +264,7 @@ class BaseAzureLLM:
|
||||||
api_base=api_base,
|
api_base=api_base,
|
||||||
model_name=model,
|
model_name=model,
|
||||||
api_version=api_version,
|
api_version=api_version,
|
||||||
|
is_async=_is_async,
|
||||||
)
|
)
|
||||||
if _is_async is True:
|
if _is_async is True:
|
||||||
openai_client = AsyncAzureOpenAI(**azure_client_params)
|
openai_client = AsyncAzureOpenAI(**azure_client_params)
|
||||||
|
@ -285,6 +287,7 @@ class BaseAzureLLM:
|
||||||
api_base: Optional[str],
|
api_base: Optional[str],
|
||||||
model_name: Optional[str],
|
model_name: Optional[str],
|
||||||
api_version: Optional[str],
|
api_version: Optional[str],
|
||||||
|
is_async: bool,
|
||||||
) -> dict:
|
) -> dict:
|
||||||
|
|
||||||
azure_ad_token_provider: Optional[Callable[[], str]] = None
|
azure_ad_token_provider: Optional[Callable[[], str]] = None
|
||||||
|
@ -340,8 +343,13 @@ class BaseAzureLLM:
|
||||||
"api_version": api_version,
|
"api_version": api_version,
|
||||||
"azure_ad_token": azure_ad_token,
|
"azure_ad_token": azure_ad_token,
|
||||||
"azure_ad_token_provider": azure_ad_token_provider,
|
"azure_ad_token_provider": azure_ad_token_provider,
|
||||||
"http_client": litellm.client_session,
|
|
||||||
}
|
}
|
||||||
|
# init http client + SSL Verification settings
|
||||||
|
if is_async is True:
|
||||||
|
azure_client_params["http_client"] = self._get_async_http_client
|
||||||
|
else:
|
||||||
|
azure_client_params["http_client"] = self._get_sync_http_client
|
||||||
|
|
||||||
if max_retries is not None:
|
if max_retries is not None:
|
||||||
azure_client_params["max_retries"] = max_retries
|
azure_client_params["max_retries"] = max_retries
|
||||||
if timeout is not None:
|
if timeout is not None:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue