- Resource: Template
- FilterConfig
- RaiFilterSettings
- RaiFilter
- RaiFilterType
- DetectionConfidenceLevel
- SdpFilterSettings
- SdpBasicConfig
- SdpBasicConfigEnforcement
- SdpAdvancedConfig
- PiAndJailbreakFilterSettings
- PiAndJailbreakFilterEnforcement
- MaliciousUriFilterSettings
- MaliciousUriFilterEnforcement
- FilterRuleSettings
- FilterRuleSet
- RuleFilterType
- FilterRule
- ExclusionRule
- Dictionary
- WordList
- Regex
- MatchingScope
- CsamFilterSettings
- CsamFilterEnforcement
- TemplateMetadata
- EnforcementType
- MultiLanguageDetection
- FilterVersionSelector
- FilterVersionAlias
- Modality
- Methods
Resource: Template
Message describing Template resource
| JSON representation |
|---|
{ "name": string, "createTime": string, "updateTime": string, "labels": { string: string, ... }, "filterConfig": { object ( |
| Fields | |
|---|---|
name |
Identifier. name of resource |
createTime |
Output only. [Output only] Create time stamp Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
updateTime |
Output only. [Output only] Update time stamp Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
labels |
Optional. Labels as key value pairs An object containing a list of |
filterConfig |
Required. filter configuration for this template |
templateMetadata |
Optional. metadata for this template |
FilterConfig
Filters configuration.
| JSON representation |
|---|
{ "raiSettings": { object ( |
| Fields | |
|---|---|
raiSettings |
Optional. Responsible AI settings. |
sdpSettings |
Optional. Sensitive Data Protection settings. |
piAndJailbreakFilterSettings |
Optional. Prompt injection and Jailbreak filter settings. |
maliciousUriFilterSettings |
Optional. Malicious URI filter settings. |
filterRuleSettings |
Optional. Settings for customizing filter rules. Note: This field is not supported in FloorSetting. |
csamFilterSettings |
Optional. Child sexual abuse material (CSAM) filter settings. |
RaiFilterSettings
Responsible AI Filter settings.
| JSON representation |
|---|
{
"raiFilters": [
{
object ( |
| Fields | |
|---|---|
raiFilters[] |
Required. List of Responsible AI filters enabled for template. |
RaiFilter
Responsible AI filter.
| JSON representation |
|---|
{ "filterType": enum ( |
| Fields | |
|---|---|
filterType |
Required. Type of responsible AI filter. |
confidenceLevel |
Optional. Confidence level for this RAI filter. During data sanitization, if data is classified under this filter with a confidence level equal to or greater than the specified level, a positive match is reported. If the confidence level is unspecified (i.e., 0), the system will use a reasonable default level based on the |
RaiFilterType
Options for responsible AI Filter Types.
| Enums | |
|---|---|
RAI_FILTER_TYPE_UNSPECIFIED |
Unspecified filter type. |
SEXUALLY_EXPLICIT |
Sexually Explicit. |
HATE_SPEECH |
Hate Speech. |
HARASSMENT |
Harassment. |
DANGEROUS |
Danger |
DetectionConfidenceLevel
Confidence levels for detectors. Higher value maps to a greater confidence level. To enforce stricter level a lower value should be used.
| Enums | |
|---|---|
DETECTION_CONFIDENCE_LEVEL_UNSPECIFIED |
Same as LOW_AND_ABOVE. |
LOW_AND_ABOVE |
Highest chance of a false positive. |
MEDIUM_AND_ABOVE |
Some chance of false positives. |
HIGH |
Low chance of false positives. |
SdpFilterSettings
Sensitive Data Protection settings.
| JSON representation |
|---|
{ // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "basicConfig": { object ( |
| Fields | |
|---|---|
| Either of Sensitive Data Protection basic or advanced configuration. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: | |
basicConfig |
Optional. Basic Sensitive Data Protection configuration inspects the content for sensitive data using a fixed set of six info-types. Sensitive Data Protection templates cannot be used with basic configuration. Only Sensitive Data Protection inspection operation is supported with basic configuration. |
advancedConfig |
Optional. Advanced Sensitive Data Protection configuration which enables use of Sensitive Data Protection templates. Supports both Sensitive Data Protection inspection and de-identification operations. |
| End of mutually exclusive fields. | |
SdpBasicConfig
Sensitive Data Protection basic configuration.
| JSON representation |
|---|
{
"filterEnforcement": enum ( |
| Fields | |
|---|---|
filterEnforcement |
Optional. Tells whether the Sensitive Data Protection basic config is enabled or disabled. |
SdpBasicConfigEnforcement
Option to specify the state of Sensitive Data Protection basic config (ENABLED/DISABLED).
| Enums | |
|---|---|
SDP_BASIC_CONFIG_ENFORCEMENT_UNSPECIFIED |
Same as Disabled |
ENABLED |
Enabled |
DISABLED |
Disabled |
SdpAdvancedConfig
Sensitive Data Protection Advanced configuration.
| JSON representation |
|---|
{ "inspectTemplate": string, "deidentifyTemplate": string } |
| Fields | |
|---|---|
inspectTemplate |
Optional. Sensitive Data Protection inspect template resource name If only inspect template is provided (de-identify template not provided), then Sensitive Data Protection InspectContent action is performed during Sanitization. All Sensitive Data Protection findings identified during inspection will be returned as SdpFinding in SdpInsepctionResult. e.g. |
deidentifyTemplate |
Optional. Optional Sensitive Data Protection Deidentify template resource name. If provided then DeidentifyContent action is performed during Sanitization using this template and inspect template. The De-identified data will be returned in SdpDeidentifyResult. Note that all info-types present in the deidentify template must be present in inspect template. e.g. |
PiAndJailbreakFilterSettings
Prompt injection and Jailbreak Filter settings.
| JSON representation |
|---|
{ "filterEnforcement": enum ( |
| Fields | |
|---|---|
filterEnforcement |
Optional. Tells whether Prompt injection and Jailbreak filter is enabled or disabled. |
confidenceLevel |
Optional. Confidence level for this filter. Confidence level is used to determine the threshold for the filter. If detection confidence is equal to or greater than the specified level, a positive match is reported. Confidence level will only be used if the filter is enabled. |
PiAndJailbreakFilterEnforcement
Option to specify the state of Prompt Injection and Jailbreak filter (ENABLED/DISABLED).
| Enums | |
|---|---|
PI_AND_JAILBREAK_FILTER_ENFORCEMENT_UNSPECIFIED |
Same as Disabled |
ENABLED |
Enabled |
DISABLED |
Disabled |
MaliciousUriFilterSettings
Malicious URI filter settings.
| JSON representation |
|---|
{
"filterEnforcement": enum ( |
| Fields | |
|---|---|
filterEnforcement |
Optional. Tells whether the Malicious URI filter is enabled or disabled. |
MaliciousUriFilterEnforcement
Option to specify the state of Malicious URI filter (ENABLED/DISABLED).
| Enums | |
|---|---|
MALICIOUS_URI_FILTER_ENFORCEMENT_UNSPECIFIED |
Same as Disabled |
ENABLED |
Enabled |
DISABLED |
Disabled |
FilterRuleSettings
Settings for customizing filter rules.
| JSON representation |
|---|
{
"ruleSets": [
{
object ( |
| Fields | |
|---|---|
ruleSets[] |
Optional. List of rule sets to be applied to filters. |
FilterRuleSet
A set of rules that modifies the behavior of specific filters based on the rules defined within the set.
| JSON representation |
|---|
{ "filterTypes": [ enum ( |
| Fields | |
|---|---|
filterTypes[] |
Required. List of filters this rule set is applied to. |
rules[] |
Required. Set of rules to be applied to filterTypes. |
RuleFilterType
Model Armor Filter types supported for rules.
| Enums | |
|---|---|
RULE_FILTER_TYPE_UNSPECIFIED |
Unspecified filter type. |
PROMPT_INJECTION_AND_JAILBREAK |
Prompt injection and jailbreak filter. |
RESPONSIBLE_AI |
Responsible AI filter. |
FilterRule
A single rule to be applied to filters, specified in FilterRuleSet.
| JSON representation |
|---|
{
// The following is a list of mutually exclusive fields. At most one of the
// fields will be set in a response:
"exclusionRule": {
object ( |
| Fields | |
|---|---|
| Rule types. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: | |
exclusionRule |
Exclusion rule. |
| End of mutually exclusive fields. | |
ExclusionRule
The rule that specifies conditions when filter detections are excluded from results.
| JSON representation |
|---|
{ // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "dictionary": { object ( |
| Fields | |
|---|---|
| Exclusion rule types. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: | |
dictionary |
Dictionary which defines the rule. |
regex |
Regular expression which defines the rule. |
| End of mutually exclusive fields. | |
matchingScope |
Optional. Specifies the scope of the input that should be matched against the exclusion rule. If unspecified, defaults to MATCHING_SCOPE_PARTIAL_MATCH. |
Dictionary
Message defining a custom dictionary of words or phrases for syntactic match.
Dictionary words are case-insensitive and all characters other than letters and digits in the unicode Basic Multilingual Plane will be replaced with whitespace when scanning for matches. For example, the dictionary phrase Sam Johnson will match all three phrases sam johnson, Sam, Johnson, and Sam (Johnson). Additionally, the characters surrounding any match must be of a different type than the adjacent characters within the word, so letters must be next to non-letters and digits must be next to non-digits. For example, the dictionary word jen will match the first three letters of the text jen123 but will return no matches for jennifer.
Dictionary words containing a large number of characters that are not letters or digits may result in unexpected matches because such characters are treated as whitespace. For details about the size limits of dictionaries, see Quotas and limits.
| JSON representation |
|---|
{
// The following is a list of mutually exclusive fields. At most one of the
// fields will be set in a response:
"wordList": {
object ( |
| Fields | |
|---|---|
| Source of the dictionary. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: | |
wordList |
Message defining a list of words or phrases. |
| End of mutually exclusive fields. | |
WordList
Message defining a list of words or phrases.
| JSON representation |
|---|
{ "words": [ string ] } |
| Fields | |
|---|---|
words[] |
Required. Words or phrases defining the dictionary. The dictionary must contain at least one phrase and every phrase must contain at least two characters that are letters or digits. |
Regex
Message defining a custom regular expression.
| JSON representation |
|---|
{ "pattern": string } |
| Fields | |
|---|---|
pattern |
Required. The regular expression pattern. |
MatchingScope
Defines the scope of the match for a rule.
Additional values may be added to this enum in the future.
| Enums | |
|---|---|
MATCHING_SCOPE_UNSPECIFIED |
Unspecified matching scope. |
MATCHING_SCOPE_FULL_MATCH |
Full match.
|
MATCHING_SCOPE_PARTIAL_MATCH |
Partial match.
|
CsamFilterSettings
Child sexual abuse material (CSAM) filter settings.
| JSON representation |
|---|
{ "filterEnforcement": enum ( |
| Fields | |
|---|---|
filterEnforcement |
Optional. Specifies whether the CSAM filter is enabled or disabled. |
confidenceLevel |
Optional. Confidence level for this CSAM filter. This field is used to determine the threshold for the filter. If detection confidence is greater than or equal to the specified level, a positive match is reported. Confidence level will only be used if the filter is enabled. |
CsamFilterEnforcement
Option to specify the enforcement state for the CSAM filter.
| Enums | |
|---|---|
CSAM_FILTER_ENFORCEMENT_UNSPECIFIED |
Unused. Default value. If unspecified, defaults to ENABLED (with HIGH confidence), except for Data Residency (DRZ) compliant resources in regions where CSAM detection is unsupported, where it defaults to DISABLED. |
ENABLED |
Enables CSAM detection filtering for user prompts and model responses. |
DISABLED |
Disables CSAM detection filtering for user prompts and model responses. |
TemplateMetadata
Message describing TemplateMetadata
| JSON representation |
|---|
{ "ignorePartialInvocationFailures": boolean, "customPromptSafetyErrorCode": integer, "customPromptSafetyErrorMessage": string, "customLlmResponseSafetyErrorCode": integer, "customLlmResponseSafetyErrorMessage": string, "logTemplateOperations": boolean, "logSanitizeOperations": boolean, "enforcementType": enum ( |
| Fields | |
|---|---|
ignorePartialInvocationFailures |
Optional. If true, partial detector failures should be ignored. |
customPromptSafetyErrorCode |
Optional. Indicates the custom error code set by the user to be returned to the end user by the service extension if the prompt trips Model Armor filters. |
customPromptSafetyErrorMessage |
Optional. Indicates the custom error message set by the user to be returned to the end user if the prompt trips Model Armor filters. |
customLlmResponseSafetyErrorCode |
Optional. Indicates the custom error code set by the user to be returned to the end user if the LLM response trips Model Armor filters. |
customLlmResponseSafetyErrorMessage |
Optional. Indicates the custom error message set by the user to be returned to the end user if the LLM response trips Model Armor filters. |
logTemplateOperations |
Optional. If true, log template crud operations. |
logSanitizeOperations |
Optional. If true, log sanitize operations. |
enforcementType |
Optional. Enforcement type for Model Armor filters. |
multiLanguageDetection |
Optional. Metadata for multi language detection. |
modalities[] |
Optional. Specifies the modalities to scan. If not specified or empty, only text modality will be scanned. |
filterVersionSelector |
Optional. Specifies the configuration for the Filter version to be used. If this field is populated, it takes precedence over any values set in the deprecated |
dataResidencyCompliant |
Optional. Indicates whether the template is subject to data residency compliance. If true (default for new templates), the template is subject to data residency compliance. If false, the template bypasses data residency compliance checks. |
EnforcementType
Enforcement type for Model Armor filters.
| Enums | |
|---|---|
ENFORCEMENT_TYPE_UNSPECIFIED |
Default value. Same as INSPECT_AND_BLOCK. |
INSPECT_ONLY |
Model Armor filters will run in inspect only mode. No action will be taken on the request. |
INSPECT_AND_BLOCK |
Model Armor filters will run in inspect and block mode. Requests that trip Model Armor filters will be blocked. |
MultiLanguageDetection
Metadata to enable multi language detection via template.
| JSON representation |
|---|
{ "enableMultiLanguageDetection": boolean } |
| Fields | |
|---|---|
enableMultiLanguageDetection |
Required. If true, multi language detection will be enabled. |
FilterVersionSelector
Represents the configuration for selecting a Filter Version. Allows customers to choose to use either a specific version or a predefined alias.
| JSON representation |
|---|
{
// The following is a list of mutually exclusive fields. At most one of the
// fields will be set in a response:
"version": string,
"alias": enum ( |
| Fields | |
|---|---|
| Specifies whether to use a specific version or an alias. The 'oneof' ensures that only one of these fields can be set. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: | |
version |
Allows customers to pin to a specific, immutable Filter Version. This provides stability, as this will not change after a version upgrade. Expected format is a case-sensitive string, e.g., "v1", "v2". Requests providing an invalid or non-existent version string will be rejected with an |
alias |
Allows customers to use a predefined alias that dynamically points to a specific version based on internal upgrades. This offers flexibility and reduces the need for template updates. |
| End of mutually exclusive fields. | |
FilterVersionAlias
Enum for Filter Version Aliases. These aliases provide a way to always point to a specific track without needing to update the version in templates.
| Enums | |
|---|---|
FILTER_VERSION_ALIAS_UNSPECIFIED |
The default value. If used, it will resolve to the STABLE alias. |
FILTER_VERSION_ALIAS_STABLE |
STABLE alias points to the most recent stable model version. Using this alias means no code changes are required when a new model becomes the stable version. |
FILTER_VERSION_ALIAS_LATEST |
LATEST alias points to the newest model version available. This version is subject to frequent revisions and offers SLO guarantees but does not assure stability, providing the most current security protections. |
FILTER_VERSION_ALIAS_LEGACY |
LEGACY alias could be used for sanitization operations for a transition period. New templates cannot be created with this version. |
FILTER_VERSION_ALIAS_RETIRED |
RETIRED alias could be used for versions that are no longer available to be used. While new templates cannot be created with this alias, any existing template or request using RETIRED version will fall back to the current STABLE version for sanitization operations. |
Modality
This enum is used in the TemplateMetadata and FloorSettingMetadata messages to indicate the modality supported for sanitize API calls.
| Enums | |
|---|---|
MODALITY_UNSPECIFIED |
Unspecified modality. If specified, all modalities will be sanitized. |
MODALITY_TEXT |
Represents text modality. If specified, it will sanitize text fields, and text extracted from rich text files (like PDFs, DOCs) and plain text files (like TXT). |
MODALITY_IMAGE |
Represents image modality. If specified, it will sanitize image files. The visual content and the text content in the image will be sanitized depending on the filter configuration. |
Methods |
|
|---|---|
|
Creates a new Template in a given project and location. |
|
Deletes a single Template. |
|
Gets details of a single Template. |
|
Lists Templates in a given project and location. |
|
Updates the parameters of a single Template. |
|
Sanitizes Model Response. |
|
Sanitizes User Prompt. |