1.0.0-beta10 (latest) 1.0.0-beta09

    public sealed class Guardrail.Types.LlmPolicy : IMessage<Guardrail.Types.LlmPolicy>, IEquatable<Guardrail.Types.LlmPolicy>, IDeepCloneable<Guardrail.Types.LlmPolicy>, IBufferMessage, IMessage

Reference documentation and code samples for the Gemini Enterprise for Customer Experience v1beta API class Guardrail.Types.LlmPolicy.

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

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> Guardrail.Types.LlmPolicy

## Implements

[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[Guardrail](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1Beta/latest/Google.Cloud.Ces.V1Beta.Guardrail)[Types](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1Beta/latest/Google.Cloud.Ces.V1Beta.Guardrail.Types)[LlmPolicy](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1Beta/latest/Google.Cloud.Ces.V1Beta.Guardrail.Types.LlmPolicy), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[Guardrail](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1Beta/latest/Google.Cloud.Ces.V1Beta.Guardrail)[Types](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1Beta/latest/Google.Cloud.Ces.V1Beta.Guardrail.Types)[LlmPolicy](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1Beta/latest/Google.Cloud.Ces.V1Beta.Guardrail.Types.LlmPolicy), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[Guardrail](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1Beta/latest/Google.Cloud.Ces.V1Beta.Guardrail)[Types](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1Beta/latest/Google.Cloud.Ces.V1Beta.Guardrail.Types)[LlmPolicy](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1Beta/latest/Google.Cloud.Ces.V1Beta.Guardrail.Types.LlmPolicy), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html)

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Cloud.Ces.V1Beta](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1Beta/latest/Google.Cloud.Ces.V1Beta)

## Assembly

Google.Cloud.Ces.V1Beta.dll

## Constructors

### LlmPolicy()

    public LlmPolicy()

### LlmPolicy(LlmPolicy)

    public LlmPolicy(Guardrail.Types.LlmPolicy other)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `other` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1Beta/latest/Google.Cloud.Ces.V1Beta.Guardrailhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1Beta/latest/Google.Cloud.Ces.V1Beta.Guardrail.Typeshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1Beta/latest/Google.Cloud.Ces.V1Beta.Guardrail.Types.LlmPolicy` |

## 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** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` |   |

### 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** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` |   |

### 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** |
| `https://learn.microsoft.com/dotnet/api/system.int32` |   |

### ModelSettings

    public ModelSettings ModelSettings { get; set; }

Optional. Model settings.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1Beta/latest/Google.Cloud.Ces.V1Beta.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** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1Beta/latest/Google.Cloud.Ces.V1Beta.Guardrailhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1Beta/latest/Google.Cloud.Ces.V1Beta.Guardrail.Typeshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1Beta/latest/Google.Cloud.Ces.V1Beta.Guardrail.Types.LlmPolicyhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1Beta/latest/Google.Cloud.Ces.V1Beta.Guardrail.Types.LlmPolicy.Typeshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1Beta/latest/Google.Cloud.Ces.V1Beta.Guardrail.Types.LlmPolicy.Types.PolicyScope` |   |

### Prompt

    public string Prompt { get; set; }

Required. Policy prompt. Supports session variable placeholders (`{var}`)
as well as `{agent_system_instruction}` to inject the agent's resolved
system instructions.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |