Class Guardrail.LlmPolicy (0.1.0)

public static final class Guardrail.LlmPolicy extends GeneratedMessage implements Guardrail.LlmPolicyOrBuilder

Guardrail that blocks the conversation if the LLM response is considered violating the policy based on the LLM classification.

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

Static Fields

ALLOW_SHORT_UTTERANCE_FIELD_NUMBER

public static final int ALLOW_SHORT_UTTERANCE_FIELD_NUMBER
Field Value
Type Description
int

FAIL_OPEN_FIELD_NUMBER

public static final int FAIL_OPEN_FIELD_NUMBER
Field Value
Type Description
int

MAX_CONVERSATION_MESSAGES_FIELD_NUMBER

public static final int MAX_CONVERSATION_MESSAGES_FIELD_NUMBER
Field Value
Type Description
int

MODEL_SETTINGS_FIELD_NUMBER

public static final int MODEL_SETTINGS_FIELD_NUMBER
Field Value
Type Description
int

POLICY_SCOPE_FIELD_NUMBER

public static final int POLICY_SCOPE_FIELD_NUMBER
Field Value
Type Description
int

PROMPT_FIELD_NUMBER

public static final int PROMPT_FIELD_NUMBER
Field Value
Type Description
int

Static Methods

getDefaultInstance()

public static Guardrail.LlmPolicy getDefaultInstance()
Returns
Type Description
Guardrail.LlmPolicy

getDescriptor()

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

newBuilder()

public static Guardrail.LlmPolicy.Builder newBuilder()
Returns
Type Description
Guardrail.LlmPolicy.Builder

newBuilder(Guardrail.LlmPolicy prototype)

public static Guardrail.LlmPolicy.Builder newBuilder(Guardrail.LlmPolicy prototype)
Parameter
Name Description
prototype Guardrail.LlmPolicy
Returns
Type Description
Guardrail.LlmPolicy.Builder

parseDelimitedFrom(InputStream input)

public static Guardrail.LlmPolicy parseDelimitedFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
Guardrail.LlmPolicy
Exceptions
Type Description
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Guardrail.LlmPolicy parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Guardrail.LlmPolicy
Exceptions
Type Description
IOException

parseFrom(byte[] data)

public static Guardrail.LlmPolicy parseFrom(byte[] data)
Parameter
Name Description
data byte[]
Returns
Type Description
Guardrail.LlmPolicy
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

public static Guardrail.LlmPolicy parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data byte[]
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Guardrail.LlmPolicy
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data)

public static Guardrail.LlmPolicy parseFrom(ByteString data)
Parameter
Name Description
data ByteString
Returns
Type Description
Guardrail.LlmPolicy
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

public static Guardrail.LlmPolicy parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteString
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Guardrail.LlmPolicy
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

public static Guardrail.LlmPolicy parseFrom(CodedInputStream input)
Parameter
Name Description
input CodedInputStream
Returns
Type Description
Guardrail.LlmPolicy
Exceptions
Type Description
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public static Guardrail.LlmPolicy parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Guardrail.LlmPolicy
Exceptions
Type Description
IOException

parseFrom(InputStream input)

public static Guardrail.LlmPolicy parseFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
Guardrail.LlmPolicy
Exceptions
Type Description
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Guardrail.LlmPolicy parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Guardrail.LlmPolicy
Exceptions
Type Description
IOException

parseFrom(ByteBuffer data)

public static Guardrail.LlmPolicy parseFrom(ByteBuffer data)
Parameter
Name Description
data ByteBuffer
Returns
Type Description
Guardrail.LlmPolicy
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

public static Guardrail.LlmPolicy parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteBuffer
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Guardrail.LlmPolicy
Exceptions
Type Description
InvalidProtocolBufferException

parser()

public static Parser<Guardrail.LlmPolicy> parser()
Returns
Type Description
Parser<LlmPolicy>

Methods

equals(Object obj)

public boolean equals(Object obj)
Parameter
Name Description
obj Object
Returns
Type Description
boolean
Overrides

getAllowShortUtterance()

public boolean getAllowShortUtterance()

Optional. By default, the LLM policy check is bypassed for short utterances. Enabling this setting applies the policy check to all utterances, including those that would normally be skipped.

bool allow_short_utterance = 6 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
boolean

The allowShortUtterance.

getDefaultInstanceForType()

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

getFailOpen()

public boolean getFailOpen()

Optional. If an error occurs during the policy check, fail open and do not trigger the guardrail.

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

Returns
Type Description
boolean

The failOpen.

getMaxConversationMessages()

public int getMaxConversationMessages()

Optional. When checking this policy, consider the last 'n' messages in the conversation. When not set a default value of 10 will be used.

int32 max_conversation_messages = 1 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
int

The maxConversationMessages.

getModelSettings()

public ModelSettings getModelSettings()

Optional. Model settings.

.google.cloud.ces.v1.ModelSettings model_settings = 2 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
ModelSettings

The modelSettings.

getModelSettingsOrBuilder()

public ModelSettingsOrBuilder getModelSettingsOrBuilder()

Optional. Model settings.

.google.cloud.ces.v1.ModelSettings model_settings = 2 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
ModelSettingsOrBuilder

getParserForType()

public Parser<Guardrail.LlmPolicy> getParserForType()
Returns
Type Description
Parser<LlmPolicy>
Overrides

getPolicyScope()

public Guardrail.LlmPolicy.PolicyScope getPolicyScope()

Required. Defines when to apply the policy check during the conversation. If set to POLICY_SCOPE_UNSPECIFIED, the policy will be applied to the user input. When applying the policy to the agent response, additional latency will be introduced before the agent can respond.

.google.cloud.ces.v1.Guardrail.LlmPolicy.PolicyScope policy_scope = 4 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
Guardrail.LlmPolicy.PolicyScope

The policyScope.

getPolicyScopeValue()

public int getPolicyScopeValue()

Required. Defines when to apply the policy check during the conversation. If set to POLICY_SCOPE_UNSPECIFIED, the policy will be applied to the user input. When applying the policy to the agent response, additional latency will be introduced before the agent can respond.

.google.cloud.ces.v1.Guardrail.LlmPolicy.PolicyScope policy_scope = 4 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
int

The enum numeric value on the wire for policyScope.

getPrompt()

public String getPrompt()

Required. Policy prompt.

string prompt = 3 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
String

The prompt.

getPromptBytes()

public ByteString getPromptBytes()

Required. Policy prompt.

string prompt = 3 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
ByteString

The bytes for prompt.

getSerializedSize()

public int getSerializedSize()
Returns
Type Description
int
Overrides

hasModelSettings()

public boolean hasModelSettings()

Optional. Model settings.

.google.cloud.ces.v1.ModelSettings model_settings = 2 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
boolean

Whether the modelSettings field is set.

hashCode()

public int hashCode()
Returns
Type Description
int
Overrides

internalGetFieldAccessorTable()

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

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

newBuilderForType()

public Guardrail.LlmPolicy.Builder newBuilderForType()
Returns
Type Description
Guardrail.LlmPolicy.Builder

newBuilderForType(AbstractMessage.BuilderParent parent)

protected Guardrail.LlmPolicy.Builder newBuilderForType(AbstractMessage.BuilderParent parent)
Parameter
Name Description
parent BuilderParent
Returns
Type Description
Guardrail.LlmPolicy.Builder
Overrides

toBuilder()

public Guardrail.LlmPolicy.Builder toBuilder()
Returns
Type Description
Guardrail.LlmPolicy.Builder

writeTo(CodedOutputStream output)

public void writeTo(CodedOutputStream output)
Parameter
Name Description
output CodedOutputStream
Overrides
Exceptions
Type Description
IOException