Each Guardrail Check has a specific purpose, it’s own parameters, supported hooks, and sources.
The logic for all of the Guardrail Checks (including Partner Guardrails) is open source.
We have built Guardrails in a very modular way, and support bringing your own Guardrail using a custom webhook! Learn more here.
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 GuardrailsChecks if the request or response text matches a regex pattern.
Parameters: rule: string
Supported On: input_guardrails
, output_guardrails
Checks if the content contains a certain number of sentences. Ranges allowed.
Parameters: minSentences: number
, maxSentences: number
Supported On: input_guardrails
, output_guardrails
Checks if the content contains a certain number of words. Ranges allowed.
Parameters: minWords: number
, maxWords: number
Supported On: input_guardrails
, output_guardrails
Checks if the content contains a certain number of characters. Ranges allowed.
Parameters: minCharacters: number
, maxCharacters: number
Supported On: input_guardrails
, output_guardrails
Check if the response JSON matches a JSON schema.
Parameters: schema: json
Supported On: output_guardrails
only
Check if the response JSON contains any, all or none of the mentioned keys.
Parameters: keys: array
, operator: string
Supported On: output_guardrails
only
Checks if the content contains any, all or none of the words or phrases.
Parameters: words: array
, operator: string
Supported On: output_guardrails
only
Checks if all the URLs mentioned in the content are valid
Parameters: onlyDNS: boolean
Supported On: output_guardrails
only
Checks if the content contains code of format SQL, Python, TypeScript, etc.
Parameters: format: string
Supported On: output_guardrails
only
Check if the given string is lowercase or not.
Parameters: format: string
Supported On: input_guardrails
, output_guardrails
Check if the content ends with a specified string.
Parameters: Suffix: string
Supported On: input_guardrails
, output_guardrails
Makes a webhook request for custom guardrails
Parameters: webhookURL: string
, headers: json
Supported On: input_guardrails
, output_guardrails
Check if the JWT token is valid.
Parameters:
JWKS URI: string
,
Header Key: string
,
Cache Max Age: number
,
Clock Tolerance: number
,
Max Token Age: number
(in seconds)
Supported On: input_guardrails
Check if the inference model to be used is in the whitelist.
Parameters:
Models: array
, Inverse: boolean
Supported On: input_guardrails
PRO
— LLM GuardrailsChecks if the content passes the mentioned content moderation checks.
Parameters: categories: array
Supported On: input_guardrails
only
Checks if the response content is in the mentioned language.
Parameters: language: string
Supported On: input_guardrails
only
Detects Personally Identifiable Information (PII) in the content.
Parameters: categories: array
Supported On: input_guardrails
, output_guardrails
Detects if the content is gibberish.
Parameters: boolean
Supported On: input_guardrails
, output_guardrails
You can now have configurable timeouts for Partner & Pro Guardrails!
Integrate your Guardrail platform with Portkey Gateway and reach our growing user base. Check out some existing integrations to get started.