File tree Expand file tree Collapse file tree 1 file changed +1
-6
lines changed
Expand file tree Collapse file tree 1 file changed +1
-6
lines changed Original file line number Diff line number Diff line change 11import json
22import os
33
4- from azure .core .credentials import AzureKeyCredential
54from azure .identity .aio import AzureDeveloperCliCredential , ManagedIdentityCredential , get_bearer_token_provider
65from openai import AsyncAzureOpenAI
76from quart import (
1817
1918@bp .before_app_serving
2019async def configure_openai ():
21- if azure_openai_key := os .getenv ("AZURE_OPENAI_API_KEY_FOR_APP" ):
22- # use key credential
23- current_app .logger .info ("Using Azure OpenAI with API key" )
24- bp .azure_credential = AzureKeyCredential (azure_openai_key )
25- elif os .getenv ("RUNNING_IN_PRODUCTION" ):
20+ if os .getenv ("RUNNING_IN_PRODUCTION" ):
2621 client_id = os .environ ["AZURE_CLIENT_ID" ]
2722 current_app .logger .info ("Using Azure OpenAI with managed identity credential for client ID: %s" , client_id )
2823 bp .azure_credential = ManagedIdentityCredential (client_id = client_id )
You can’t perform that action at this time.
0 commit comments