- Resource: Template
- FilterConfig
- RaiFilterSettings
- RaiFilter
- RaiFilterType
- DetectionConfidenceLevel
- SdpFilterSettings
- SdpBasicConfig
- SdpBasicConfigEnforcement
- SdpAdvancedConfig
- PiAndJailbreakFilterSettings
- PiAndJailbreakFilterEnforcement
- MaliciousUriFilterSettings
- MaliciousUriFilterEnforcement
- 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. |
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 |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field sdp_configuration. Either of Sensitive Data Protection basic or advanced configuration. sdp_configuration can be only one of the following: |
|
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. |
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 |
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 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 |
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 |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field version_spec. Specifies whether to use a specific version or an alias. The 'oneof' ensures that only one of these fields can be set. version_spec can be only one of the following: |
|
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. |
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 |
The 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 |
The 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 |
The LEGACY alias could be used for sanitization operations for a transition period. New templates cannot be created with this version. |
FILTER_VERSION_ALIAS_RETIRED |
The 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 message 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. |