# Class Guardrail (0.7.0)

0.7.0 (latest) 0.6.0 0.5.0 0.4.0 0.3.0

    Guardrail(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Guardrail contains a list of checks and balances to keep the
agents safe and secure.

This message has `oneof`_ fields (mutually exclusive fields).
For each oneof, at most one member field can be set at the same time.
Setting any member of the oneof automatically clears all other
members.

.. _oneof: <https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields>

| ## Attributes ||
|---|---|
| **Name** | **Description** |
| `content_filter` | `https://docs.cloud.google.com/python/docs/reference/google-cloud-ces/latest/google.cloud.ces_v1.types.Guardrail.ContentFilter` Optional. Guardrail that bans certain content from being used in the conversation. This field is a member of `oneof`_ `guardrail_type`. |
| `llm_prompt_security` | `https://docs.cloud.google.com/python/docs/reference/google-cloud-ces/latest/google.cloud.ces_v1.types.Guardrail.LlmPromptSecurity` Optional. Guardrail that blocks the conversation if the prompt is considered unsafe based on the LLM classification. This field is a member of `oneof`_ `guardrail_type`. |
| `llm_policy` | `https://docs.cloud.google.com/python/docs/reference/google-cloud-ces/latest/google.cloud.ces_v1.types.Guardrail.LlmPolicy` Optional. Guardrail that blocks the conversation if the LLM response is considered violating the policy based on the LLM classification. This field is a member of `oneof`_ `guardrail_type`. |
| `model_safety` | `https://docs.cloud.google.com/python/docs/reference/google-cloud-ces/latest/google.cloud.ces_v1.types.Guardrail.ModelSafety` Optional. Guardrail that blocks the conversation if the LLM response is considered unsafe based on the model safety settings. This field is a member of `oneof`_ `guardrail_type`. |
| `code_callback` | `https://docs.cloud.google.com/python/docs/reference/google-cloud-ces/latest/google.cloud.ces_v1.types.Guardrail.CodeCallback` Optional. Guardrail that potentially blocks the conversation based on the result of the callback execution. This field is a member of `oneof`_ `guardrail_type`. |
| `name` | `str` Identifier. The unique identifier of the guardrail. Format: `projects/{project}/locations/{location}/apps/{app}/guardrails/{guardrail}` |
| `display_name` | `str` Required. Display name of the guardrail. |
| `description` | `str` Optional. Description of the guardrail. |
| `enabled` | `bool` Optional. Whether the guardrail is enabled. |
| `action` | `https://docs.cloud.google.com/python/docs/reference/google-cloud-ces/latest/google.cloud.ces_v1.types.TriggerAction` Optional. Action to take when the guardrail is triggered. |
| `create_time` | `google.protobuf.timestamp_pb2.Timestamp` Output only. Timestamp when the guardrail was created. |
| `update_time` | `google.protobuf.timestamp_pb2.Timestamp` Output only. Timestamp when the guardrail was last updated. |
| `etag` | `str` Etag used to ensure the object hasn't changed during a read-modify-write operation. If the etag is empty, the update will overwrite any concurrent changes. |

## Classes

### CodeCallback

    CodeCallback(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Guardrail that blocks the conversation based on the code
callbacks provided.

### ContentFilter

    ContentFilter(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Guardrail that bans certain content from being used in the
conversation.

### LlmPolicy

    LlmPolicy(mapping=None, *, ignore_unknown_fields=False, **kwargs)

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

### LlmPromptSecurity

    LlmPromptSecurity(mapping=None, *, ignore_unknown_fields=False, **kwargs)

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

This message has `oneof`_ fields (mutually exclusive fields).
For each oneof, at most one member field can be set at the same time.
Setting any member of the oneof automatically clears all other
members.

.. _oneof: <https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields>

### ModelSafety

    ModelSafety(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Model safety settings overrides. When this is set, it will
override the default settings and trigger the guardrail if the
response is considered unsafe.