@@ -395,7 +395,7 @@ async def setup_clients():
395
395
AZURE_SEARCH_INDEX = os .environ ["AZURE_SEARCH_INDEX" ]
396
396
# Shared by all OpenAI deployments
397
397
OPENAI_HOST = os .getenv ("OPENAI_HOST" , "azure" )
398
- OPENAI_CHATGPT_MODEL = os . environ [ "AZURE_OPENAI_CHATGPT_MODEL" ]
398
+ OPENAI_CHATGPT_MODEL = "phi3.5:latest"
399
399
OPENAI_EMB_MODEL = os .getenv ("AZURE_OPENAI_EMB_MODEL_NAME" , "text-embedding-ada-002" )
400
400
OPENAI_EMB_DIMENSIONS = int (os .getenv ("AZURE_OPENAI_EMB_DIMENSIONS" , 1536 ))
401
401
# Used with Azure OpenAI deployments
@@ -448,8 +448,16 @@ async def setup_clients():
448
448
# The managed identity is setup in the infra/ folder.
449
449
azure_credential : Union [AzureDeveloperCliCredential , ManagedIdentityCredential ]
450
450
if RUNNING_ON_AZURE :
451
- current_app .logger .info ("Setting up Azure credential using ManagedIdentityCredential" )
452
- azure_credential = ManagedIdentityCredential ()
451
+ if AZURE_CLIENT_ID := os .getenv ("AZURE_CLIENT_ID" ):
452
+ # ManagedIdentityCredential should use AZURE_CLIENT_ID if set in env, but its not working for some reason,
453
+ # so we explicitly pass it in as the client ID here. This is necessary for user-assigned managed identities.
454
+ current_app .logger .info (
455
+ "Setting up Azure credential using ManagedIdentityCredential with client_id %s" , AZURE_CLIENT_ID
456
+ )
457
+ azure_credential = ManagedIdentityCredential (client_id = AZURE_CLIENT_ID )
458
+ else :
459
+ current_app .logger .info ("Setting up Azure credential using ManagedIdentityCredential" )
460
+ azure_credential = ManagedIdentityCredential ()
453
461
elif AZURE_TENANT_ID :
454
462
current_app .logger .info (
455
463
"Setting up Azure credential using AzureDeveloperCliCredential with tenant_id %s" , AZURE_TENANT_ID
@@ -705,9 +713,10 @@ def create_app():
705
713
# Log levels should be one of https://docs.python.org/3/library/logging.html#logging-levels
706
714
# Set root level to WARNING to avoid seeing overly verbose logs from SDKS
707
715
logging .basicConfig (level = logging .WARNING )
708
- # Set the app logger level to INFO by default
709
- default_level = "INFO"
710
- app .logger .setLevel (os .getenv ("APP_LOG_LEVEL" , default_level ))
716
+ # Set our own logger levels to INFO by default
717
+ app_level = os .getenv ("APP_LOG_LEVEL" , "INFO" )
718
+ app .logger .setLevel (os .getenv ("APP_LOG_LEVEL" , app_level ))
719
+ logging .getLogger ("ragapp" ).setLevel (app_level )
711
720
712
721
if allowed_origin := os .getenv ("ALLOWED_ORIGIN" ):
713
722
app .logger .info ("ALLOWED_ORIGIN is set, enabling CORS for %s" , allowed_origin )
0 commit comments