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

dev: Option to disable content filter

Clémence Lesné3d3718e09cdc
diff --git a/Makefile b/Makefile
index 5dfd14e..802d80b 100644
--- a/Makefile
+++ b/Makefile
@@ -16,6 +16,8 @@ name_sanitized := $(shell echo $(name) | tr '[:upper:]' '[:lower:]')
bot_phone_number ?= $(shell cat config.yaml | yq '.communication_services.phone_number')
event_subscription_name ?= $(shell echo '$(name_sanitized)-$(bot_phone_number)' | tr -dc '[:alnum:]-')
twilio_phone_number ?= $(shell cat config.yaml | yq '.sms.twilio.phone_number')
+# Bicep inputs
+prompt_content_filter ?= true
# Bicep outputs
app_url ?= $(shell az deployment sub show --name $(name_sanitized) | yq '.properties.outputs["appUrl"].value')
blob_storage_public_name ?= $(shell az deployment sub show --name $(name_sanitized) | yq '.properties.outputs["blobStoragePublicName"].value')
@@ -139,6 +141,7 @@ deploy-bicep:
'functionappLocation=$(functionapp_location)' \
'instance=$(name)' \
'openaiLocation=$(openai_location)' \
+ 'promptContentFilter=$(prompt_content_filter)' \
'searchLocation=$(search_location)' \
'version=$(version_full)' \
--template-file bicep/main.bicep \
diff --git a/bicep/app.bicep b/bicep/app.bicep
index 7a39238..65c9ceb 100644
--- a/bicep/app.bicep
+++ b/bicep/app.bicep
@@ -16,6 +16,7 @@ param llmSlowQuota int
param llmSlowVersion string
param location string
param openaiLocation string
+param promptContentFilter bool
param searchLocation string
param tags object
param version string
@@ -473,6 +474,7 @@ resource contentfilter 'Microsoft.CognitiveServices/accounts/raiPolicies@2024-04
contentFilters: [
// Indirect attacks
{
+ allowedContentLevel: 'Medium'
blocking: true
enabled: true
name: 'indirect_attack'
@@ -480,6 +482,7 @@ resource contentfilter 'Microsoft.CognitiveServices/accounts/raiPolicies@2024-04
}
// Jailbreak
{
+ allowedContentLevel: 'Medium'
blocking: true
enabled: true
name: 'jailbreak'
@@ -487,63 +490,73 @@ resource contentfilter 'Microsoft.CognitiveServices/accounts/raiPolicies@2024-04
}
// Prompt
{
- blocking: false
- enabled: false
+ allowedContentLevel: 'Low'
+ blocking: !promptContentFilter
+ enabled: !promptContentFilter
name: 'hate'
source: 'Prompt'
}
{
- blocking: false
- enabled: false
+ allowedContentLevel: 'Low'
+ blocking: !promptContentFilter
+ enabled: !promptContentFilter
name: 'sexual'
source: 'Prompt'
}
{
- blocking: false
- enabled: false
+ allowedContentLevel: 'Low'
+ blocking: !promptContentFilter
+ enabled: !promptContentFilter
name: 'selfharm'
source: 'Prompt'
}
{
- blocking: false
- enabled: false
+ allowedContentLevel: 'Low'
+ blocking: !promptContentFilter
+ enabled: !promptContentFilter
name: 'violence'
source: 'Prompt'
}
{
- blocking: false
- enabled: false
+ allowedContentLevel: 'Low'
+ blocking: !promptContentFilter
+ enabled: !promptContentFilter
name: 'profanity'
source: 'Prompt'
}
// Completion
{
- blocking: false
- enabled: false
+ allowedContentLevel: 'Low'
+ blocking: !promptContentFilter
+ enabled: !promptContentFilter
name: 'hate'
source: 'Completion'
}
{
- blocking: false
- enabled: false
+ allowedContentLevel: 'Low'
+ blocking: !promptContentFilter
+ enabled: !promptContentFilter
name: 'sexual'
source: 'Completion'
}
{
- blocking: false
- enabled: false
+ allowedContentLevel: 'Low'
+ blocking: !promptContentFilter
+ enabled: !promptContentFilter
name: 'selfharm'
source: 'Completion'
}
{
- blocking: false
- enabled: false
+ allowedContentLevel: 'Low'
+ blocking: !promptContentFilter
+ enabled: !promptContentFilter
name: 'violence'
source: 'Completion'
}
{
- blocking: false
- enabled: false
+ allowedContentLevel: 'Low'
+ blocking: !promptContentFilter
+ enabled: !promptContentFilter
name: 'profanity'
source: 'Completion'
}
diff --git a/bicep/main.bicep b/bicep/main.bicep
index fdef80a..2162b04 100644
--- a/bicep/main.bicep
+++ b/bicep/main.bicep
@@ -1,5 +1,5 @@
param cognitiveCommunicationLocation string
-param embeddingDeploymentType string = 'Standard' // Pay-as-you-go in a single region
+param embeddingDeploymentType string = 'Standard' // Pay-as-you-go in a single region
param embeddingModel string = 'text-embedding-ada-002'
param embeddingQuota int = 100
param embeddingVersion string = '2'
@@ -17,6 +17,7 @@ param llmSlowQuota int = 400
param llmSlowVersion string = '2024-05-13'
param location string = deployment().location
param openaiLocation string
+param promptContentFilter bool = true // Should be set to false but requires a custom approval from Microsoft
param searchLocation string
param version string
@@ -64,6 +65,7 @@ module app 'app.bicep' = {
llmSlowVersion: llmSlowVersion
location: location
openaiLocation: openaiLocation
+ promptContentFilter: promptContentFilter
searchLocation: searchLocation
tags: tags
version: version