Skip to content

Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!

Python

infra: Fix temp deployment issues and add custom LLM moderation rule

Clémence Lesné6913cc24c22e
diff --git a/README.md b/README.md
index 9340841..40d79b5 100644
--- a/README.md
+++ b/README.md
@@ -283,7 +283,7 @@ Steps to deploy:
2. Create the local `config.yaml` file (like the example above)
3. Connect to your Azure environment (e.g. `az login`)
4. Run deployment with `make deploy name=my-instance`
-5. Wait for the deployment to finish (if it fails for a `'null' not found` error, retry the command)
+5. Wait for the deployment to finish
6. Link the AI multi-service account named `[my-instance]-communication` to the Communication Services resource
7. Create a AI Search index named `trainings` plus a semantic search configuration named `default` on the index
diff --git a/bicep/app.bicep b/bicep/app.bicep
index cfc8614..5754ab3 100644
--- a/bicep/app.bicep
+++ b/bicep/app.bicep
@@ -532,6 +532,87 @@ resource cognitiveOpenai 'Microsoft.CognitiveServices/accounts@2024-04-01-previe
}
}
+resource contentfilter 'Microsoft.CognitiveServices/accounts/raiPolicies@2024-04-01-preview' = {
+ parent: cognitiveOpenai
+ name: 'disabled'
+ tags: tags
+ properties: {
+ basePolicyName: 'Microsoft.Default'
+ mode: 'Default'
+ contentFilters: [
+ // Jailbreak
+ {
+ blocking: true
+ enabled: true
+ name: 'jailbreak'
+ source: 'Prompt'
+ }
+ // Prompt
+ {
+ blocking: false
+ enabled: false
+ name: 'hate'
+ source: 'Prompt'
+ }
+ {
+ blocking: false
+ enabled: false
+ name: 'sexual'
+ source: 'Prompt'
+ }
+ {
+ blocking: false
+ enabled: false
+ name: 'selfharm'
+ source: 'Prompt'
+ }
+ {
+ blocking: false
+ enabled: false
+ name: 'violence'
+ source: 'Prompt'
+ }
+ {
+ blocking: false
+ enabled: false
+ name: 'profanity'
+ source: 'Prompt'
+ }
+ // Completion
+ {
+ blocking: false
+ enabled: false
+ name: 'hate'
+ source: 'Completion'
+ }
+ {
+ blocking: false
+ enabled: false
+ name: 'sexual'
+ source: 'Completion'
+ }
+ {
+ blocking: false
+ enabled: false
+ name: 'selfharm'
+ source: 'Completion'
+ }
+ {
+ blocking: false
+ enabled: false
+ name: 'violence'
+ source: 'Completion'
+ }
+ {
+ blocking: false
+ enabled: false
+ name: 'profanity'
+ source: 'Completion'
+ }
+ ]
+ }
+}
+
resource llmSlow 'Microsoft.CognitiveServices/accounts/deployments@2024-04-01-preview' = {
parent: cognitiveOpenai
name: llmSlowModelFullName
@@ -541,7 +622,7 @@ resource llmSlow 'Microsoft.CognitiveServices/accounts/deployments@2024-04-01-pr
name: llmSlowDeploymentType
}
properties: {
- // raiPolicyName: contentfilter.name
+ raiPolicyName: contentfilter.name
versionUpgradeOption: 'NoAutoUpgrade'
model: {
format: 'OpenAI'
@@ -560,7 +641,7 @@ resource llmFast 'Microsoft.CognitiveServices/accounts/deployments@2024-04-01-pr
name: llmFastDeploymentType
}
properties: {
- // raiPolicyName: contentfilter.name
+ raiPolicyName: contentfilter.name
versionUpgradeOption: 'NoAutoUpgrade'
model: {
format: 'OpenAI'
@@ -568,68 +649,11 @@ resource llmFast 'Microsoft.CognitiveServices/accounts/deployments@2024-04-01-pr
version: llmFastVersion
}
}
+ dependsOn: [
+ llmSlow
+ ]
}
-// resource contentfilter 'Microsoft.CognitiveServices/accounts/raiPolicies@2023-06-01-preview' = {
-// parent: cognitiveOpenai
-// name: 'disabled'
-// tags: tags
-// properties: {
-// basePolicyName: 'Microsoft.Default'
-// mode: 'Default'
-// contentFilters: [
-// {
-// blocking: false
-// enabled: false
-// name: 'hate'
-// source: 'Prompt'
-// }
-// {
-// blocking: false
-// enabled: false
-// name: 'sexual'
-// source: 'Prompt'
-// }
-// {
-// blocking: false
-// enabled: false
-// name: 'selfharm'
-// source: 'Prompt'
-// }
-// {
-// blocking: false
-// enabled: false
-// name: 'violence'
-// source: 'Prompt'
-// }
-// {
-// blocking: false
-// enabled: false
-// name: 'hate'
-// source: 'Completion'
-// }
-// {
-// blocking: false
-// enabled: false
-// name: 'sexual'
-// source: 'Completion'
-// }
-// {
-// blocking: false
-// enabled: false
-// name: 'selfharm'
-// source: 'Completion'
-// }
-// {
-// blocking: false
-// enabled: false
-// name: 'violence'
-// source: 'Completion'
-// }
-// ]
-// }
-// }
-
resource embedding 'Microsoft.CognitiveServices/accounts/deployments@2024-04-01-preview' = {
parent: cognitiveOpenai
name: embeddingModelFullName
@@ -639,7 +663,7 @@ resource embedding 'Microsoft.CognitiveServices/accounts/deployments@2024-04-01-
name: embeddingDeploymentType
}
properties: {
- // raiPolicyName: contentfilter.name
+ raiPolicyName: contentfilter.name
versionUpgradeOption: 'NoAutoUpgrade'
model: {
format: 'OpenAI'
@@ -647,6 +671,9 @@ resource embedding 'Microsoft.CognitiveServices/accounts/deployments@2024-04-01-
version: embeddingVersion
}
}
+ dependsOn: [
+ llmFast
+ ]
}
resource cosmos 'Microsoft.DocumentDB/databaseAccounts@2024-05-15' = {