diff --git a/.github/workflows/update-labs-config.yml b/.github/workflows/update-labs-config.yml index 43fde1c4..ac885302 100644 --- a/.github/workflows/update-labs-config.yml +++ b/.github/workflows/update-labs-config.yml @@ -21,6 +21,7 @@ on: permissions: contents: write pull-requests: write + issues: write jobs: update-labs-config: diff --git a/docs/labs-config.json b/docs/labs-config.json index 1a11eb95..c1c583da 100644 --- a/docs/labs-config.json +++ b/docs/labs-config.json @@ -204,9 +204,9 @@ "authors": [ "vieiraae" ], - "githubPath": "https://github.com/Azure-Samples/AI-Gateway/tree/main/labs/content-safety", + "githubPath": "https://github.com/seilorjunior/AI-Gateway/tree/main/labs/content-safety", "tags": [], - "lastCommitDate": "2026-02-04T13:09:52.730Z" + "lastCommitDate": "2026-02-19T18:19:32.694Z" }, { "id": "finops-framework", diff --git a/labs/backend-pool-load-balancing-tf/policy.xml b/labs/backend-pool-load-balancing-tf/policy.xml index 2201d1d4..4dfcc8a6 100644 --- a/labs/backend-pool-load-balancing-tf/policy.xml +++ b/labs/backend-pool-load-balancing-tf/policy.xml @@ -12,8 +12,7 @@ + first-fast-retry="true" condition="@(context.Response.StatusCode == 429 || context.Response.StatusCode == 503)"> diff --git a/labs/backend-pool-load-balancing/policy.xml b/labs/backend-pool-load-balancing/policy.xml index 056d16cc..866c53e5 100644 --- a/labs/backend-pool-load-balancing/policy.xml +++ b/labs/backend-pool-load-balancing/policy.xml @@ -5,7 +5,7 @@ - + diff --git a/labs/content-safety/content-safety.ipynb b/labs/content-safety/content-safety.ipynb index 33a73533..865fe632 100644 --- a/labs/content-safety/content-safety.ipynb +++ b/labs/content-safety/content-safety.ipynb @@ -38,11 +38,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": { "metadata": {} }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "✅ \u001b[1;32mNotebook initialized\u001b[0m ⌚ 14:09:29.586513 \n" + ] + } + ], "source": [ "import os, sys, json\n", "sys.path.insert(1, '../../shared') # add the shared directory to the Python path\n", @@ -81,9 +89,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "⚙️ \u001b[1;34mRunning: az account show \u001b[0m\n", + "✅ \u001b[1;32mRetrieved az account\u001b[0m ⌚ 14:09:39.477474 [0m:4s]\n", + "👉🏽 \u001b[1;34mCurrent user: seilorjunior@microsoft.com\u001b[0m\n", + "👉🏽 \u001b[1;34mTenant ID: 16b3c013-d300-468d-ac64-7eda0820b6d3\u001b[0m\n", + "👉🏽 \u001b[1;34mSubscription ID: 08a7f106-3eed-4add-8328-3d18b01d8ef1\u001b[0m\n" + ] + } + ], "source": [ "output = utils.run(\"az account show\", \"Retrieved az account\", \"Failed to get the current az account\")\n", "\n", @@ -111,7 +131,15 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "⚙️ \u001b[1;34mRunning: az group show --name lab-content-safety \u001b[0m\n" + ] + } + ], "source": [ "# Create the resource group if doesn't exist\n", "utils.create_resource_group(resource_group_name, resource_group_location)\n", @@ -226,7 +254,7 @@ ], "metadata": { "kernelspec": { - "display_name": "myenv", + "display_name": "Python 3", "language": "python", "name": "python3" }, @@ -240,7 +268,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.13.5" + "version": "3.13.12" } }, "nbformat": 4, diff --git a/labs/content-safety/main.bicep b/labs/content-safety/main.bicep index 7464a5f3..83f45ac9 100644 --- a/labs/content-safety/main.bicep +++ b/labs/content-safety/main.bicep @@ -40,23 +40,8 @@ module foundryModule '../../modules/cognitive-services/v3/foundry.bicep' = { } } -// 3. APIM Inference API -module inferenceAPIModule '../../modules/apim/v2/inference-api.bicep' = { - name: 'inferenceAPIModule' - params: { - policyXml: loadTextContent('policy.xml') - aiServicesConfig: foundryModule.outputs.extendedAIServicesConfig - inferenceAPIType: inferenceAPIType - inferenceAPIPath: inferenceAPIPath - configureCircuitBreaker: true - } -} - resource apim 'Microsoft.ApiManagement/service@2024-06-01-preview' existing = { name: 'apim-${resourceSuffix}' - dependsOn: [ - inferenceAPIModule - ] } // 4. Content Safety @@ -146,6 +131,24 @@ resource contentSafetyBackend 'Microsoft.ApiManagement/service/backends@2024-06- } } } + dependsOn: [ + apimModule + ] +} + +// 3. APIM Inference API - Must be deployed after Content Safety backend +module inferenceAPIModule '../../modules/apim/v2/inference-api.bicep' = { + name: 'inferenceAPIModule' + params: { + policyXml: loadTextContent('policy.xml') + aiServicesConfig: foundryModule.outputs.extendedAIServicesConfig + inferenceAPIType: inferenceAPIType + inferenceAPIPath: inferenceAPIPath + configureCircuitBreaker: true + } + dependsOn: [ + contentSafetyBackend + ] } // ------------------