public sealed class Guardrail.Types.LlmPolicy : IMessage<Guardrail.Types.LlmPolicy>, IEquatable<Guardrail.Types.LlmPolicy>, IDeepCloneable<Guardrail.Types.LlmPolicy>, IBufferMessage, IMessageReference documentation and code samples for the Gemini Enterprise for Customer Experience v1 API class Guardrail.Types.LlmPolicy.
Guardrail that blocks the conversation if the LLM response is considered violating the policy based on the LLM classification.
Implements
IMessageGuardrailTypesLlmPolicy, IEquatableGuardrailTypesLlmPolicy, IDeepCloneableGuardrailTypesLlmPolicy, IBufferMessage, IMessageNamespace
Google.Cloud.Ces.V1Assembly
Google.Cloud.Ces.V1.dll
Constructors
LlmPolicy()
public LlmPolicy()LlmPolicy(LlmPolicy)
public LlmPolicy(Guardrail.Types.LlmPolicy other)| Parameter | |
|---|---|
| Name | Description |
other |
GuardrailTypesLlmPolicy |
Properties
AllowShortUtterance
public bool AllowShortUtterance { get; set; }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.
| Property Value | |
|---|---|
| Type | Description |
bool |
|
FailOpen
public bool FailOpen { get; set; }Optional. If an error occurs during the policy check, fail open and do not trigger the guardrail.
| Property Value | |
|---|---|
| Type | Description |
bool |
|
MaxConversationMessages
public int MaxConversationMessages { get; set; }Optional. When checking this policy, consider the last 'n' messages in the conversation. When not set a default value of 10 will be used.
| Property Value | |
|---|---|
| Type | Description |
int |
|
ModelSettings
public ModelSettings ModelSettings { get; set; }Optional. Model settings.
| Property Value | |
|---|---|
| Type | Description |
ModelSettings |
|
PolicyScope
public Guardrail.Types.LlmPolicy.Types.PolicyScope PolicyScope { get; set; }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.
| Property Value | |
|---|---|
| Type | Description |
GuardrailTypesLlmPolicyTypesPolicyScope |
|
Prompt
public string Prompt { get; set; }Required. Policy prompt.
| Property Value | |
|---|---|
| Type | Description |
string |
|