Guardrails
The configuration object below all lives in the schema at ai-experimental.guards
, which is an object keyed with your unique guard id.
name
Type
string!
Description
The human-readable name of the Guard.
description
Type
string
Description
A description of the Guard.
blockedInputMessaging
Type
string
Description
A message to return when the input message is blocked by the Guard.
blockedOutputsMessaging
Type
string
Description
A message to return when the output message is blocked by the Guard.
topicPolicyConfig
Type
TopicPolicyConfig
Description
Topics to identify and block.
Schema
{
"type": "object",
"properties": {
"topicsConfig": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"definition": {
"type": "string"
},
"examples": {
"type": "array",
"items": {
"type": "string"
}
},
"type": {
"enum": ["DENY"]
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false
}
contentPolicyConfig
Type
ContentPolicyConfig
Description
Types of content to filter and strength configuration.
Schema
{
"type": "object",
"properties": {
"filtersConfig": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["HATE", "INSULTS", "MICONDUCT", "PROMPT_ATTACK", "SEXUAL", "VIOLENCE"]
},
"inputStrength": {
"type": "string",
"enum": ["NONE", "HIGH", "LOW", "MEDIUM"]
},
"outputStrength": {
"type": "string",
"enum": ["NONE", "HIGH", "LOW", "MEDIUM"]
},
"inputModalities": {
"type": "array",
"items": {
"type": "string",
"enum": ["TEXT", "IMAGGE"]
}
},
"outputModalities": {
"type": "array",
"items": {
"type": "string",
"enum": ["TEXT", "IMAGGE"]
}
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false
}
wordPolicyConfig
Type
WordPolicyConfig
Description
Specific words to identify and block. The managedWordListsConfig
is solely used for blocking profanity.
Schema
{
"type": "object",
"properties": {
"wordsConfig": {
"type": "array",
"items": {
"type": "object",
"properties": {
"text": {
"type": "string"
}
},
"additionalProperties": false
}
},
"managedWordListsConfig": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["PROFANITY"]
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false
}
sensitiveInformationPolicyConfig
Type
SensitiveInformationPolicyConfig
Description
Filter out and block or obscure sensitive information. piiEntitiesConfig
will infer from the text certain PII categories, while regexesConfig
will evaluate regular expressions. Matching text will be handled per the policy.
Schema
{
"type": "object",
"properties": {
"piiEntitiesConfig": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"ADDRESS",
"AGE",
"AWS_ACCESS_KEY",
"AWS_SECRET_KEY",
"CA_HEALTH_NUMBER",
"CA_SOCIAL_INSURANCE_NUMBER",
"CREDIT_DEBIT_CARD_CVV",
"CREDIT_DEBIT_CARD_EXPIRY",
"CREDIT_DEBIT_CARD_NUMBER",
"DRIVER_ID",
"EMAIL",
"INTERNATIONAL_BANK_ACCOUNT_NUMBER",
"IP_ADDRESS",
"LICENSE_PLATE",
"MAC_ADDRESS",
"NAME",
"PASSWORD",
"PHONE",
"PIN",
"SWIFT_CODE",
"UK_NATIONAL_HEALTH_SERVICE_NUMBER",
"UK_NATIONAL_INSURANCE_NUMBER",
"UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER",
"URL",
"USERNAME",
"US_BANK_ACCOUNT_NUMBER",
"US_BANK_ROUTING_NUMBER",
"US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER",
"US_PASSPORT_NUMBER",
"US_SOCIAL_SECURITY_NUMBER",
"VEHICLE_IDENTIFICATION_NUMBER"
]
},
"action": {
"$ref": "#/definitions/guardrailSensitiveInformationAction"
}
},
"additionalProperties": false
}
},
"regexesConfig": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"description": {
"type": "string"
},
"pattern": {
"type": "string"
},
"action": {
"$ref": "#/definitions/guardrailSensitiveInformationAction"
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false
}
contextualGroundingPolicyConfig
Type
ContextualGroundingPolicyConfig
Description
Provides evaluations based on grounding text supplied by your in-context agent variables. Off-topic conversations can then be blocked.
Schema
{
"type": "object",
"properties": {
"filtersConfig": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["GROUNDING", "RELEVANCE"]
},
"threshold": {
"type": "number"
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false
}