Alibaba Cloud AI Guardrails
The AI Guardrail API service provided by Alibaba Cloud Security, safeguard your models and AI applications.
Overview
This node integrates with Alibaba Cloud's AI Guardrails service to analyze and detect potentially harmful or sensitive content within text data. It is designed to safeguard AI models and applications by performing security checks on input or output text, identifying issues such as content moderation flags, sensitive data exposure, prompt attacks, malicious URLs or files, and watermarks.
Common scenarios where this node is beneficial include:
- Moderating user-generated content before processing or publishing.
- Validating AI model outputs to ensure compliance with safety policies.
- Detecting sensitive or malicious content in chatbots, forums, or social media platforms.
- Enhancing security workflows by automatically flagging risky text data.
Practical example:
- A chatbot platform uses this node to scan user inputs for inappropriate language or sensitive information before passing it to the AI model.
- An application reviews AI-generated responses to prevent the dissemination of harmful or misleading content.
Properties
| Name | Meaning |
|---|---|
| Content | The text content to be analyzed by the AI Guardrails service. |
| Detection Type | Specifies whether to detect issues in the "Input" text (user-provided) or "Output" text (AI-generated). Options: Input, Output |
Output
The node outputs an array of JSON objects, each corresponding to an input item analyzed. Each object contains:
_finalSuggestion: Overall suggestion result from the AI Guardrails service (e.g., "pass", "block").contentModerationSuggestion: Suggestion related to content moderation checks.sensitiveDataSuggestion: Suggestion regarding detection of sensitive data.promptAttackSuggestion: Suggestion about potential prompt injection or attack attempts.maliciousUrlSuggestion: Suggestion related to detection of malicious URLs.maliciousFileSuggestion: Suggestion related to detection of malicious files.waterMark: URL string pointing to any detected watermark file.desensitization: Information about desensitization applied to sensitive data.responses: Raw detailed responses from the AI Guardrails API for further inspection.
If the node encounters multiple segments of long text, it splits them and aggregates results accordingly.
The node does not output binary data.
Dependencies
- Requires an API key credential for Alibaba Cloud AI Guardrails service (access key ID and secret).
- Uses HTTP POST requests to the Alibaba Cloud endpoint
https://green-cip.ap-southeast-1.aliyuncs.com. - Requires n8n credentials configuration with appropriate access keys.
- Utilizes cryptographic signing (HMAC-SHA1) for request authentication.
- Depends on the
form-datapackage to format HTTP requests.
Troubleshooting
- API invocation failures: If the node throws errors indicating failure codes from the API, verify that the provided API credentials are correct and have sufficient permissions.
- Request throttling or timeouts: Large text inputs are split into smaller chunks; however, very large payloads or high-frequency calls may hit rate limits. Consider batching or reducing input size.
- Invalid or missing parameters: Ensure the "Content" property is properly set and not empty. The "Detection Type" must be either "input" or "output".
- Error messages containing HTTP status codes 4xx or 5xx: These indicate client or server errors respectively. For client errors, check input validity and credentials. For server errors, retry later or contact support.
- Continue on Fail behavior: If enabled, the node will append error details to the output instead of stopping execution, useful for bulk processing.
Links and References
- Alibaba Cloud AI Guardrails Product Page
- n8n Documentation - Creating Custom Nodes
- Alibaba Cloud API Signature Version 1.0 (for understanding request signing)