Google Cloud Ces V1 Client - Class LlmPromptSecurity (0.1.0)

Reference documentation and code samples for the Google Cloud Ces V1 Client class LlmPromptSecurity.

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

Generated from protobuf message google.cloud.ces.v1.Guardrail.LlmPromptSecurity

Namespace

Google \ Cloud \ Ces \ V1 \ Guardrail

Methods

__construct

Constructor.

Parameters
Name Description
data array

Optional. Data for populating the Message object.

↳ default_settings LlmPromptSecurity\DefaultSecuritySettings

Optional. Use the system's predefined default security settings. To select this mode, include an empty 'default_settings' message in the request. The 'default_prompt_template' field within will be populated by the server in the response.

↳ custom_policy LlmPolicy

Optional. Use a user-defined LlmPolicy to configure the security guardrail.

↳ fail_open bool

Optional. Determines the behavior when the guardrail encounters an LLM error. - If true: the guardrail is bypassed. - If false (default): the guardrail triggers/blocks. Note: If a custom policy is provided, this field is ignored in favor of the policy's 'fail_open' configuration.

getDefaultSettings

Optional. Use the system's predefined default security settings.

To select this mode, include an empty 'default_settings' message in the request. The 'default_prompt_template' field within will be populated by the server in the response.

Returns
Type Description
LlmPromptSecurity\DefaultSecuritySettings|null

hasDefaultSettings

setDefaultSettings

Optional. Use the system's predefined default security settings.

To select this mode, include an empty 'default_settings' message in the request. The 'default_prompt_template' field within will be populated by the server in the response.

Parameter
Name Description
var LlmPromptSecurity\DefaultSecuritySettings
Returns
Type Description
$this

getCustomPolicy

Optional. Use a user-defined LlmPolicy to configure the security guardrail.

Returns
Type Description
LlmPolicy|null

hasCustomPolicy

setCustomPolicy

Optional. Use a user-defined LlmPolicy to configure the security guardrail.

Parameter
Name Description
var LlmPolicy
Returns
Type Description
$this

getFailOpen

Optional. Determines the behavior when the guardrail encounters an LLM error.

  • If true: the guardrail is bypassed.
  • If false (default): the guardrail triggers/blocks. Note: If a custom policy is provided, this field is ignored in favor of the policy's 'fail_open' configuration.
Returns
Type Description
bool

setFailOpen

Optional. Determines the behavior when the guardrail encounters an LLM error.

  • If true: the guardrail is bypassed.
  • If false (default): the guardrail triggers/blocks. Note: If a custom policy is provided, this field is ignored in favor of the policy's 'fail_open' configuration.
Parameter
Name Description
var bool
Returns
Type Description
$this

getSecurityConfig

Returns
Type Description
string