diff --git a/backend/open_webui/routers/openai.py b/backend/open_webui/routers/openai.py index 9c1325e..a19f128 100644 --- a/backend/open_webui/routers/openai.py +++ b/backend/open_webui/routers/openai.py @@ -10,7 +10,6 @@ from urllib.parse import quote, urlparse import aiohttp from aiocache import cached -from azure.identity import DefaultAzureCredential, get_bearer_token_provider from fastapi import APIRouter, Depends, HTTPException, Request, status from fastapi.responses import ( FileResponse, @@ -218,6 +217,8 @@ def get_microsoft_entra_id_access_token(): Get Microsoft Entra ID access token using DefaultAzureCredential for Azure OpenAI. Returns the token string or None if authentication fails. """ + from azure.identity import DefaultAzureCredential, get_bearer_token_provider + try: token_provider = get_bearer_token_provider( DefaultAzureCredential(), 'https://cognitiveservices.azure.com/.default'