Skip to content

Commit

Permalink
fix ai content safety endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
ruoccofabrizio committed Oct 23, 2023
1 parent fa85ce9 commit 22bf7f6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions backend/utilities/helpers/EnvHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ def __init__(self, **kwargs) -> None:
self.APPINSIGHTS_CONNECTION_STRING = os.getenv('APPINSIGHTS_CONNECTION_STRING', '')
# Azure AI Content Safety
self.AZURE_CONTENT_SAFETY_ENDPOINT = os.getenv('AZURE_CONTENT_SAFETY_ENDPOINT', '')
if 'https' not in self.AZURE_CONTENT_SAFETY_ENDPOINT and 'cognitiveservices.azure.com' not in self.AZURE_CONTENT_SAFETY_ENDPOINT:
self.AZURE_CONTENT_SAFETY_ENDPOINT = f"https://{self.AZURE_CONTENT_SAFETY_ENDPOINT}.cognitiveservices.azure.com/"
if 'https' not in self.AZURE_CONTENT_SAFETY_ENDPOINT and 'api.cognitive.microsoft.com' not in self.AZURE_CONTENT_SAFETY_ENDPOINT:
self.AZURE_CONTENT_SAFETY_ENDPOINT = self.AZURE_FORM_RECOGNIZER_ENDPOINT
self.AZURE_CONTENT_SAFETY_KEY = os.getenv('AZURE_CONTENT_SAFETY_KEY', '')
# Orchestration Settings
self.ORCHESTRATION_STRATEGY = os.getenv('ORCHESTRATION_STRATEGY', 'openai_function')
Expand Down
6 changes: 3 additions & 3 deletions infrastructure/deployment.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ resource Website 'Microsoft.Web/sites@2020-06-01' = {
{ name: 'AZURE_BLOB_ACCOUNT_KEY', value: listKeys(StorageAccount.id, '2019-06-01').keys[0].value}
{ name: 'AZURE_BLOB_CONTAINER_NAME', value: BlobContainerName}
{ name: 'ORCHESTRATION_STRATEGY', value: OrchestrationStrategy}
{ name: 'AZURE_CONTENT_SAFETY_ENDPOINT', value: ContentSafetyName}
{ name: 'AZURE_CONTENT_SAFETY_ENDPOINT', value: 'https://${Location}.api.cognitive.microsoft.com/'}
{ name: 'AZURE_CONTENT_SAFETY_KEY', value: listKeys('Microsoft.CognitiveServices/accounts/${ContentSafetyName}', '2023-05-01').key1}
]
linuxFxVersion: WebAppImageName
Expand Down Expand Up @@ -297,7 +297,7 @@ resource WebsiteName_admin 'Microsoft.Web/sites@2020-06-01' = {
{ name: 'BACKEND_URL', value: 'https://${FunctionName}.azurewebsites.net'}
{ name: 'FUNCTION_KEY', value: ClientKey}
{ name: 'ORCHESTRATION_STRATEGY', value: OrchestrationStrategy}
{ name: 'AZURE_CONTENT_SAFETY_ENDPOINT', value: ContentSafetyName}
{ name: 'AZURE_CONTENT_SAFETY_ENDPOINT', value: 'https://${Location}.api.cognitive.microsoft.com/'}
{ name: 'AZURE_CONTENT_SAFETY_KEY', value: listKeys('Microsoft.CognitiveServices/accounts/${ContentSafetyName}', '2023-05-01').key1}
]
linuxFxVersion: AdminWebAppImageName
Expand Down Expand Up @@ -404,7 +404,7 @@ resource Function 'Microsoft.Web/sites@2018-11-01' = {
{ name: 'AZURE_OPENAI_API_VERSION', value: AzureOpenAIApiVersion}
{ name: 'AZURE_SEARCH_INDEX', value: AzureSearchIndex}
{ name: 'ORCHESTRATION_STRATEGY', value: OrchestrationStrategy}
{ name: 'AZURE_CONTENT_SAFETY_ENDPOINT', value: ContentSafetyName}
{ name: 'AZURE_CONTENT_SAFETY_ENDPOINT', value: 'https://${Location}.api.cognitive.microsoft.com/'}
{ name: 'AZURE_CONTENT_SAFETY_KEY', value: listKeys('Microsoft.CognitiveServices/accounts/${ContentSafetyName}', '2023-05-01').key1}
]
cors: {
Expand Down
10 changes: 5 additions & 5 deletions infrastructure/deployment.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.21.1.54444",
"templateHash": "4730872359172000762"
"version": "0.22.6.54827",
"templateHash": "7427399133148149700"
}
},
"parameters": {
Expand Down Expand Up @@ -502,7 +502,7 @@
},
{
"name": "AZURE_CONTENT_SAFETY_ENDPOINT",
"value": "[parameters('ContentSafetyName')]"
"value": "[format('https://{0}.api.cognitive.microsoft.com/', parameters('Location'))]"
},
{
"name": "AZURE_CONTENT_SAFETY_KEY",
Expand Down Expand Up @@ -665,7 +665,7 @@
},
{
"name": "AZURE_CONTENT_SAFETY_ENDPOINT",
"value": "[parameters('ContentSafetyName')]"
"value": "[format('https://{0}.api.cognitive.microsoft.com/', parameters('Location'))]"
},
{
"name": "AZURE_CONTENT_SAFETY_KEY",
Expand Down Expand Up @@ -849,7 +849,7 @@
},
{
"name": "AZURE_CONTENT_SAFETY_ENDPOINT",
"value": "[parameters('ContentSafetyName')]"
"value": "[format('https://{0}.api.cognitive.microsoft.com/', parameters('Location'))]"
},
{
"name": "AZURE_CONTENT_SAFETY_KEY",
Expand Down

0 comments on commit 22bf7f6

Please sign in to comment.