Class Guardrail.LlmPromptSecurity.Builder (0.1.0)

public static final class Guardrail.LlmPromptSecurity.Builder extends GeneratedMessage.Builder<Guardrail.LlmPromptSecurity.Builder> implements Guardrail.LlmPromptSecurityOrBuilder

Guardrail that blocks the conversation if the input is considered unsafe based on the LLM classification.

Protobuf type google.cloud.ces.v1.Guardrail.LlmPromptSecurity

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

Methods

build()

public Guardrail.LlmPromptSecurity build()
Returns
Type Description
Guardrail.LlmPromptSecurity

buildPartial()

public Guardrail.LlmPromptSecurity buildPartial()
Returns
Type Description
Guardrail.LlmPromptSecurity

clear()

public Guardrail.LlmPromptSecurity.Builder clear()
Returns
Type Description
Guardrail.LlmPromptSecurity.Builder
Overrides

clearCustomPolicy()

public Guardrail.LlmPromptSecurity.Builder clearCustomPolicy()

Optional. Use a user-defined LlmPolicy to configure the security guardrail.

.google.cloud.ces.v1.Guardrail.LlmPolicy custom_policy = 2 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
Guardrail.LlmPromptSecurity.Builder

clearDefaultSettings()

public Guardrail.LlmPromptSecurity.Builder clearDefaultSettings()

Optional. Use the system's predefined default security settings. To select this mode, include an empty 'default_settings' message in the request. The 'default_prompt_template' field within will be populated by the server in the response.

.google.cloud.ces.v1.Guardrail.LlmPromptSecurity.DefaultSecuritySettings default_settings = 1 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
Guardrail.LlmPromptSecurity.Builder

clearFailOpen()

public Guardrail.LlmPromptSecurity.Builder clearFailOpen()

Optional. Determines the behavior when the guardrail encounters an LLM error.

  • If true: the guardrail is bypassed.
  • If false (default): the guardrail triggers/blocks.

    Note: If a custom policy is provided, this field is ignored in favor of the policy's 'fail_open' configuration.

bool fail_open = 3 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
Guardrail.LlmPromptSecurity.Builder

This builder for chaining.

clearSecurityConfig()

public Guardrail.LlmPromptSecurity.Builder clearSecurityConfig()
Returns
Type Description
Guardrail.LlmPromptSecurity.Builder

getCustomPolicy()

public Guardrail.LlmPolicy getCustomPolicy()

Optional. Use a user-defined LlmPolicy to configure the security guardrail.

.google.cloud.ces.v1.Guardrail.LlmPolicy custom_policy = 2 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
Guardrail.LlmPolicy

The customPolicy.

getCustomPolicyBuilder()

public Guardrail.LlmPolicy.Builder getCustomPolicyBuilder()

Optional. Use a user-defined LlmPolicy to configure the security guardrail.

.google.cloud.ces.v1.Guardrail.LlmPolicy custom_policy = 2 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
Guardrail.LlmPolicy.Builder

getCustomPolicyOrBuilder()

public Guardrail.LlmPolicyOrBuilder getCustomPolicyOrBuilder()

Optional. Use a user-defined LlmPolicy to configure the security guardrail.

.google.cloud.ces.v1.Guardrail.LlmPolicy custom_policy = 2 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
Guardrail.LlmPolicyOrBuilder

getDefaultInstanceForType()

public Guardrail.LlmPromptSecurity getDefaultInstanceForType()
Returns
Type Description
Guardrail.LlmPromptSecurity

getDefaultSettings()

public Guardrail.LlmPromptSecurity.DefaultSecuritySettings getDefaultSettings()

Optional. Use the system's predefined default security settings. To select this mode, include an empty 'default_settings' message in the request. The 'default_prompt_template' field within will be populated by the server in the response.

.google.cloud.ces.v1.Guardrail.LlmPromptSecurity.DefaultSecuritySettings default_settings = 1 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
Guardrail.LlmPromptSecurity.DefaultSecuritySettings

The defaultSettings.

getDefaultSettingsBuilder()

public Guardrail.LlmPromptSecurity.DefaultSecuritySettings.Builder getDefaultSettingsBuilder()

Optional. Use the system's predefined default security settings. To select this mode, include an empty 'default_settings' message in the request. The 'default_prompt_template' field within will be populated by the server in the response.

.google.cloud.ces.v1.Guardrail.LlmPromptSecurity.DefaultSecuritySettings default_settings = 1 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
Guardrail.LlmPromptSecurity.DefaultSecuritySettings.Builder

getDefaultSettingsOrBuilder()

public Guardrail.LlmPromptSecurity.DefaultSecuritySettingsOrBuilder getDefaultSettingsOrBuilder()

Optional. Use the system's predefined default security settings. To select this mode, include an empty 'default_settings' message in the request. The 'default_prompt_template' field within will be populated by the server in the response.

.google.cloud.ces.v1.Guardrail.LlmPromptSecurity.DefaultSecuritySettings default_settings = 1 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
Guardrail.LlmPromptSecurity.DefaultSecuritySettingsOrBuilder

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
Type Description
Descriptor
Overrides

getFailOpen()

public boolean getFailOpen()

Optional. Determines the behavior when the guardrail encounters an LLM error.

  • If true: the guardrail is bypassed.
  • If false (default): the guardrail triggers/blocks.

    Note: If a custom policy is provided, this field is ignored in favor of the policy's 'fail_open' configuration.

bool fail_open = 3 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
boolean

The failOpen.

getSecurityConfigCase()

public Guardrail.LlmPromptSecurity.SecurityConfigCase getSecurityConfigCase()
Returns
Type Description
Guardrail.LlmPromptSecurity.SecurityConfigCase

hasCustomPolicy()

public boolean hasCustomPolicy()

Optional. Use a user-defined LlmPolicy to configure the security guardrail.

.google.cloud.ces.v1.Guardrail.LlmPolicy custom_policy = 2 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
boolean

Whether the customPolicy field is set.

hasDefaultSettings()

public boolean hasDefaultSettings()

Optional. Use the system's predefined default security settings. To select this mode, include an empty 'default_settings' message in the request. The 'default_prompt_template' field within will be populated by the server in the response.

.google.cloud.ces.v1.Guardrail.LlmPromptSecurity.DefaultSecuritySettings default_settings = 1 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
boolean

Whether the defaultSettings field is set.

internalGetFieldAccessorTable()

protected GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

mergeCustomPolicy(Guardrail.LlmPolicy value)

public Guardrail.LlmPromptSecurity.Builder mergeCustomPolicy(Guardrail.LlmPolicy value)

Optional. Use a user-defined LlmPolicy to configure the security guardrail.

.google.cloud.ces.v1.Guardrail.LlmPolicy custom_policy = 2 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value Guardrail.LlmPolicy
Returns
Type Description
Guardrail.LlmPromptSecurity.Builder

mergeDefaultSettings(Guardrail.LlmPromptSecurity.DefaultSecuritySettings value)

public Guardrail.LlmPromptSecurity.Builder mergeDefaultSettings(Guardrail.LlmPromptSecurity.DefaultSecuritySettings value)

Optional. Use the system's predefined default security settings. To select this mode, include an empty 'default_settings' message in the request. The 'default_prompt_template' field within will be populated by the server in the response.

.google.cloud.ces.v1.Guardrail.LlmPromptSecurity.DefaultSecuritySettings default_settings = 1 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value Guardrail.LlmPromptSecurity.DefaultSecuritySettings
Returns
Type Description
Guardrail.LlmPromptSecurity.Builder

mergeFrom(Guardrail.LlmPromptSecurity other)

public Guardrail.LlmPromptSecurity.Builder mergeFrom(Guardrail.LlmPromptSecurity other)
Parameter
Name Description
other Guardrail.LlmPromptSecurity
Returns
Type Description
Guardrail.LlmPromptSecurity.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public Guardrail.LlmPromptSecurity.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Guardrail.LlmPromptSecurity.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

public Guardrail.LlmPromptSecurity.Builder mergeFrom(Message other)
Parameter
Name Description
other Message
Returns
Type Description
Guardrail.LlmPromptSecurity.Builder
Overrides

setCustomPolicy(Guardrail.LlmPolicy value)

public Guardrail.LlmPromptSecurity.Builder setCustomPolicy(Guardrail.LlmPolicy value)

Optional. Use a user-defined LlmPolicy to configure the security guardrail.

.google.cloud.ces.v1.Guardrail.LlmPolicy custom_policy = 2 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value Guardrail.LlmPolicy
Returns
Type Description
Guardrail.LlmPromptSecurity.Builder

setCustomPolicy(Guardrail.LlmPolicy.Builder builderForValue)

public Guardrail.LlmPromptSecurity.Builder setCustomPolicy(Guardrail.LlmPolicy.Builder builderForValue)

Optional. Use a user-defined LlmPolicy to configure the security guardrail.

.google.cloud.ces.v1.Guardrail.LlmPolicy custom_policy = 2 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
builderForValue Guardrail.LlmPolicy.Builder
Returns
Type Description
Guardrail.LlmPromptSecurity.Builder

setDefaultSettings(Guardrail.LlmPromptSecurity.DefaultSecuritySettings value)

public Guardrail.LlmPromptSecurity.Builder setDefaultSettings(Guardrail.LlmPromptSecurity.DefaultSecuritySettings value)

Optional. Use the system's predefined default security settings. To select this mode, include an empty 'default_settings' message in the request. The 'default_prompt_template' field within will be populated by the server in the response.

.google.cloud.ces.v1.Guardrail.LlmPromptSecurity.DefaultSecuritySettings default_settings = 1 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value Guardrail.LlmPromptSecurity.DefaultSecuritySettings
Returns
Type Description
Guardrail.LlmPromptSecurity.Builder

setDefaultSettings(Guardrail.LlmPromptSecurity.DefaultSecuritySettings.Builder builderForValue)

public Guardrail.LlmPromptSecurity.Builder setDefaultSettings(Guardrail.LlmPromptSecurity.DefaultSecuritySettings.Builder builderForValue)

Optional. Use the system's predefined default security settings. To select this mode, include an empty 'default_settings' message in the request. The 'default_prompt_template' field within will be populated by the server in the response.

.google.cloud.ces.v1.Guardrail.LlmPromptSecurity.DefaultSecuritySettings default_settings = 1 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
builderForValue Guardrail.LlmPromptSecurity.DefaultSecuritySettings.Builder
Returns
Type Description
Guardrail.LlmPromptSecurity.Builder

setFailOpen(boolean value)

public Guardrail.LlmPromptSecurity.Builder setFailOpen(boolean value)

Optional. Determines the behavior when the guardrail encounters an LLM error.

  • If true: the guardrail is bypassed.
  • If false (default): the guardrail triggers/blocks.

    Note: If a custom policy is provided, this field is ignored in favor of the policy's 'fail_open' configuration.

bool fail_open = 3 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value boolean

The failOpen to set.

Returns
Type Description
Guardrail.LlmPromptSecurity.Builder

This builder for chaining.