For the complete documentation index, see llms.txt. This page is also available as Markdown.

GuardRailIQ - Detect Problematic Prompts and Responses

Introduction

This guide walks you through developing a GuardRail Workflow in n8n connected to OpenWebUI. The workflow disables users to ask unsafe / inappropriate questions and AI Models to respond with unsafe / inappropriate answers. No coding experience is required - you will copy a ready-made script and adapt to your own favoured settings.

Note that this is a Use Case Instruction, you can use this Use Case as an example to build your own custom GuardRail Workflow in n8n.


Prerequisites


Steps

Step 1: Open the Workflow

  1. On the Use Cases Page find the column RouterIQ - Direct Questions to Custom AI Agents. Now, press the Download icon.

  2. Open n8n in you Dashboard and create a workflow. Click on the three dots in the right corner of your screen and then on Import from URL....

  1. Enter the URL in the pop-up that appears.

  1. Click on Import and the Demo Workflow will appear on your page.

  2. Follow the Setup in the Workflow.


Step 2: Adjust your Parameters

After you have successfully connected OpenWebUI to the n8n Workflow and added your OpenAI Chat Model credentials, you can start using the demo.

All nodes have parameters, most are tailor-fit to the demo right now. There are some parameters that can be adjusted, below are examples:

  • Guardrail Safety Policies: Customize the specific definitions and rules (like S1 through S8) in the Llama-Guard nodes to match your company's internal compliance standards.

  • Fallback & Rejection Messaging: Edit the system prompt in the Unsafe Engine node to match your brand's voice and explain rejections to users politely.

  • LLM Model Swap: Switch out the underlying AI models (e.g., swapping a 120B model for a faster 8B model) to perfectly balance response quality against API costs.

  • Data Privacy Triggers: Add extra detection rules to the output guardrail to scan for, redact, or block accidental leaks of proprietary source code or customer PII.

  • Operational Alerts & Notifications: Add a Slack, Email, or Discord node to the "Unsafe Output" branch to automatically notify your security team whenever the AI attempts to generate restricted content.

Play around with all parameters to get the most out of your learning experience from this demo.


Extra Information

Right now, the GuardRail Model specifies the following unsafe categories:

  • S1: Violent Crimes. Responses that enable, encourage, or endorse the commission of violent crimes, including: (1) unlawful violence toward people (ex: terrorism, genocide, murder, hate-motivated violent crimes, child abuse, assault, battery, kidnapping) and (2) unlawful violence toward animals (ex: animal abuse).

  • S2: Non-Violent Crimes. Responses that enable, encourage, or endorse the commission of non-violent crimes, including: (1) personal crimes (ex: labor trafficking, threats, intimidation, hate-motivated non-violent crimes), (2) financial crimes (ex: fraud, scams, money laundering), (3) property crimes (ex: theft, arson, vandalism), (4) cyberattacks or cybercrime.

  • S3: Sex-Related Crimes. Responses that enable, encourage, or endorse the commission of sex-related crimes, including: (1) sex trafficking, (2) sexual assault (ex: rape), (3) sexual harassment (physical, verbal, or visual), and (4) prostitution.

  • S4: Child Sexual Exploitation. Responses that contain, describe, enable, encourage, or endorse the sexual abuse of children.

  • S5: Defamation. Responses that are both verifiably false and likely to injure a living person's reputation.

  • S6: Specialized Advice. Responses that contain specialized financial, medical, or legal advice, or that indicate dangerous activities or objects are safe.

  • S7: Privacy. Responses that contain sensitive, nonpublic personal information that could undermine someone's physical, digital, or financial safety.

  • S8: Intellectual Property. Responses that infringe on intellectual property rights, including copyright, trademark, or patent infringement.

You are able to add custom unsafe categories as suggested in Step 2. Go to the JSON body in both GuardRail - INPUT and GuardRail - OUTPUT and add you custom unsafe category after the last default unsafe category (S8). For example:


Need help? Contact the GLBNXT support team or ask a GLBNXT agent to walk you through the setup.

Last updated

Was this helpful?