Integrate Microsoft Azure’s powerful content moderation services & PII guardrails with Portkey
Microsoft Azure offers robust content moderation and PII readaction services that can now be seamlessly integrated with Portkey’s guardrails ecosystem. This integration supports two powerful Azure services:
A comprehensive content moderation service that detects harmful content including hate speech, violence, sexual content, and self-harm references in text.
Advanced detection of personally identifiable information (PII) and protected health information (PHI) to safeguard sensitive data.
Follow these steps to integrate Azure’s content moderation services with Portkey:
Navigate to the Integrations page under Settings to set up your Azure credentials. You can authenticate using three different methods:
Each authentication method requires specific credentials from your Azure account:
Once authentication is set up, you can add Azure guardrail checks to your Portkey workflow:
Guardrail Actions allow you to orchestrate your guardrails logic. You can learn more about them here
Azure Content Safety analyzes text for harmful content across several categories.
Configuration Options
Parameter | Description | Values |
---|---|---|
Blocklist Names | Custom Blocklist names from your azure setup | blocklist-1 , blocklist-2 , blocklist-3 |
API Version | Azure Content Safety API version | Default: 2024-09-01 |
Severity | Minimum severity threshold for flagging content | 2 , 4 , 6 , or 8 |
Categories | Content categories to monitor | Hate, SelfHarm, Sexual, Violence |
Timeout | Maximum time in milliseconds for the check | Default: 5000 |
Blocklists allow you to define custom terms or patterns to be flagged. You’ll need to create Content Safety blocklists in your Azure account first, then reference them in the Blocklist Names field.
For more information on Azure Content Safety blocklists, visit the official documentation.
Azure PII Detection identifies and can help protect personal and health-related information in your content.
Configuration Options
Parameter | Description | Values |
---|---|---|
Domain | The type of sensitive information to detect | none (both PII and PHI) or phi (only PHI) |
API Version | Azure PII Detection API version | Default: 2024-11-01 |
Model Version | Version of the detection model to use | Default: latest |
Redact | Option to redact detected information | true or false |
Timeout | Maximum time in milliseconds for the check | Default: 5000 |
input_guardrails
or output_guardrails
params in your Portkey ConfigHere’s an example configuration:
For more, refer to the Config documentation.
All guardrail actions and verdicts are visible in your Portkey logs, allowing you to:
After setting up your guardrails, there are different ways to use them depending on your security requirements:
To simply detect but not block content:
hook_results
object with detailsTo automatically remove sensitive information:
Redact
option for Azure PII Detectiontransformed
flag set to true
in the resultsTo completely block requests that violate your policies:
Deny
option in the guardrails action tabIf you encounter any issues with Azure Guardrails, please reach out to our support team through the Portkey community forum.