List of Guardrail Checks
Each Guardrail Check has a specific purpose, it’s own parameters, supported hooks, and sources.
Partner Guardrails
Apora
- Validate Aporia policies
- Define your Aporia policies on your Aporia dashboard and just pass the project ID in Portkey Guardrail check.
Pillar
- Scan Prompts
- Scan Responses For PII, toxicity, prompt injection detection, and more.
Patronus
- Hallucination detection
- Check for conciseness, helpfulness, politeness
- Check for gender, racial bias
- and more!
The logic for all of the Guardrail Checks (including Partner Guardrails) is open source.
Bring Your Own Guardrail
We have built Guardrails in a very modular way, and support bringing your own Guardrail using a custom webhook! Learn more here.
Portkey’s Guardrails
Along with the partner Guardrails, there are also deterministic as well as LLM-based Guardrails supported natively by Portkey.
BASIC
Guardrails are available on all Portkey plans.
PRO
Guardrails are available on Portkey Pro & Enterprise plans.
BASIC
— Deterministic Guardrails
Regex Match
Checks if the request or response text matches a regex pattern.
Parameters: rule: string
Supported Hooks: beforeRequestHook
, afterRequestHook
Sentence Count
Checks if the content contains a certain number of sentences. Ranges allowed.
Parameters: minSentences: number
, maxSentences: number
Supported Hooks: beforeRequestHook
, afterRequestHook
Word Count
Checks if the content contains a certain number of words. Ranges allowed.
Parameters: minWords: number
, maxWords: number
Supported Hooks: beforeRequestHook
, afterRequestHook
Character Count
Checks if the content contains a certain number of characters. Ranges allowed.
Parameters: minCharacters: number
, maxCharacters: number
Supported Hooks: beforeRequestHook
, afterRequestHook
JSON Schema
Check if the response JSON matches a JSON schema.
Parameters: schema: json
Supported Hooks: afterRequestHook
JSON Keys
Check if the response JSON contains any, all or none of the mentioned keys.
Parameters: keys: array
, operator: string
Supported Hooks: afterRequestHook
Contains
Checks if the content contains any, all or none of the words or phrases.
Parameters: words: array
, operator: string
Supported Hooks: afterRequestHook
Valid URLs
Checks if all the URLs mentioned in the content are valid
Parameters: onlyDNS: boolean
Supported Hooks: afterRequestHook
Contains Code
Checks if the content contains code of format SQL, Python, TypeScript, etc.
Parameters: format: string
Supported Hooks: afterRequestHook
Lowercase Detection
Check if the given string is lowercase or not.
Parameters: format: string
Supported Hooks: beforeRequestHook
, afterRequestHook
Webhook
Makes a webhook request for custom guardrails
Parameters: webhookURL: string
, headers: json
Supported Hooks: beforeRequestHook
, afterRequestHook
PRO
— LLM Guardrails
Moderate Content
Checks if the content passes the mentioned content moderation checks.
Parameters: categories: array
Supported Hooks: beforeRequestHook
Check Language
Checks if the response content is in the mentioned language.
Parameters: language: string
Supported Hooks: beforeRequestHook
Detect PII
Detects Personally Identifiable Information (PII) in the content.
Parameters: categories: array
Supported Hooks: beforeRequestHook
, afterRequestHook
Detect Gibberish
Detects if the content is gibberish.
Parameters: boolean
Supported Hooks: beforeRequestHook
, afterRequestHook
Contribute Your Guardrail
Integrate your Guardrail platform with Portkey Gateway and reach our growing user base.
Check out some existing integrations to get started.
Was this page helpful?