Reference documentation and code samples for the Google Cloud Ces V1 Client class LlmPolicy.
Guardrail that blocks the conversation if the LLM response is considered violating the policy based on the LLM classification.
Generated from protobuf message google.cloud.ces.v1.Guardrail.LlmPolicy
Namespace
Google \ Cloud \ Ces \ V1 \ GuardrailMethods
__construct
Constructor.
data
array
Optional. Data for populating the Message object.
↳ max_conversation_messages
int
Optional. When checking this policy, consider the last 'n' messages in the conversation. When not set a default value of 10 will be used.
↳ model_settings
↳ prompt
string
Required. Policy prompt.
↳ policy_scope
int
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.
↳ fail_open
bool
Optional. If an error occurs during the policy check, fail open and do not trigger the guardrail.
↳ allow_short_utterance
bool
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.
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.
int
setMaxConversationMessages
Optional. When checking this policy, consider the last 'n' messages in the conversation. When not set a default value of 10 will be used.
var
int
$this
getModelSettings
Optional. Model settings.
hasModelSettings
clearModelSettings
setModelSettings
Optional. Model settings.
$this
getPrompt
Required. Policy prompt.
string
setPrompt
Required. Policy prompt.
var
string
$this
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.
setPolicyScope
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.
$this
getFailOpen
Optional. If an error occurs during the policy check, fail open and do not trigger the guardrail.
bool
setFailOpen
Optional. If an error occurs during the policy check, fail open and do not trigger the guardrail.
var
bool
$this
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
setAllowShortUtterance
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.
var
bool
$this

