mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
(Feat) - LiteLLM Use UsernamePasswordCredential
for Azure OpenAI (#7496)
* add get_azure_ad_token_from_username_password * docs azure use username / password for auth * update doc * get_azure_ad_token_from_username_password * test test_get_azure_ad_token_from_username_password
This commit is contained in:
parent
0b4d529af8
commit
0cbecbe185
6 changed files with 131 additions and 8 deletions
|
@ -9,7 +9,10 @@ import litellm
|
|||
from litellm import get_secret, get_secret_str
|
||||
from litellm._logging import verbose_router_logger
|
||||
from litellm.llms.azure.azure import get_azure_ad_token_from_oidc
|
||||
from litellm.llms.azure.common_utils import get_azure_ad_token_from_entrata_id
|
||||
from litellm.llms.azure.common_utils import (
|
||||
get_azure_ad_token_from_entrata_id,
|
||||
get_azure_ad_token_from_username_password,
|
||||
)
|
||||
from litellm.secret_managers.get_azure_ad_token_provider import (
|
||||
get_azure_ad_token_provider,
|
||||
)
|
||||
|
@ -201,6 +204,14 @@ class InitalizeOpenAISDKClient:
|
|||
client_id=litellm_params.get("client_id"),
|
||||
client_secret=litellm_params.get("client_secret"),
|
||||
)
|
||||
if litellm_params.get("azure_username") and litellm_params.get(
|
||||
"azure_password"
|
||||
):
|
||||
azure_ad_token_provider = get_azure_ad_token_from_username_password(
|
||||
azure_username=litellm_params.get("azure_username"),
|
||||
azure_password=litellm_params.get("azure_password"),
|
||||
client_id=litellm_params.get("client_id"),
|
||||
)
|
||||
|
||||
if custom_llm_provider == "azure" or custom_llm_provider == "azure_text":
|
||||
if api_base is None or not isinstance(api_base, str):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue