Class: AWSCDK::Bedrock::CfnGuardrail::TopicConfigProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
bedrock/cfn_guardrail.rb

Overview

Details about topics for the guardrail to identify and deny.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(definition:, name:, type:, examples: nil, input_action: nil, input_enabled: nil, output_action: nil, output_enabled: nil) ⇒ TopicConfigProperty

Returns a new instance of TopicConfigProperty.

Parameters:

  • definition (String)

    A definition of the topic to deny.

  • name (String)

    The name of the topic to deny.

  • type (String)

    Specifies to deny the topic.

  • examples (Array<String>, nil) (defaults to: nil)

    A list of prompts, each of which is an example of a prompt that can be categorized as belonging to the topic.

  • input_action (String, nil) (defaults to: nil)

    Specifies the action to take when harmful content is detected in the input. Supported values include:.

  • input_enabled (Boolean, AWSCDK::IResolvable, nil) (defaults to: nil)

    Specifies whether to enable guardrail evaluation on the input.

  • output_action (String, nil) (defaults to: nil)

    Specifies the action to take when harmful content is detected in the output. Supported values include:.

  • output_enabled (Boolean, AWSCDK::IResolvable, nil) (defaults to: nil)

    Specifies whether to enable guardrail evaluation on the output.



1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
# File 'bedrock/cfn_guardrail.rb', line 1640

def initialize(definition:, name:, type:, examples: nil, input_action: nil, input_enabled: nil, output_action: nil, output_enabled: nil)
  @definition = definition
  Jsii::Type.check_type(@definition, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "definition")
  @name = name
  Jsii::Type.check_type(@name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name")
  @type = type
  Jsii::Type.check_type(@type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "type")
  @examples = examples
  Jsii::Type.check_type(@examples, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "examples") unless @examples.nil?
  @input_action = input_action
  Jsii::Type.check_type(@input_action, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "inputAction") unless @input_action.nil?
  @input_enabled = input_enabled
  Jsii::Type.check_type(@input_enabled, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "inputEnabled") unless @input_enabled.nil?
  @output_action = output_action
  Jsii::Type.check_type(@output_action, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "outputAction") unless @output_action.nil?
  @output_enabled = output_enabled
  Jsii::Type.check_type(@output_enabled, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "outputEnabled") unless @output_enabled.nil?
end

Instance Attribute Details

#definitionString (readonly)

A definition of the topic to deny.



1663
1664
1665
# File 'bedrock/cfn_guardrail.rb', line 1663

def definition
  @definition
end

#examplesArray<String>? (readonly)

A list of prompts, each of which is an example of a prompt that can be categorized as belonging to the topic.



1678
1679
1680
# File 'bedrock/cfn_guardrail.rb', line 1678

def examples
  @examples
end

#input_actionString? (readonly)

Specifies the action to take when harmful content is detected in the input. Supported values include:.

  • BLOCK – Block the content and replace it with blocked messaging.
  • NONE – Take no action but return detection information in the trace response.


1686
1687
1688
# File 'bedrock/cfn_guardrail.rb', line 1686

def input_action
  @input_action
end

#input_enabledBoolean, ... (readonly)

Specifies whether to enable guardrail evaluation on the input.

When disabled, you aren't charged for the evaluation. The evaluation doesn't appear in the response.



1693
1694
1695
# File 'bedrock/cfn_guardrail.rb', line 1693

def input_enabled
  @input_enabled
end

#nameString (readonly)

The name of the topic to deny.



1668
1669
1670
# File 'bedrock/cfn_guardrail.rb', line 1668

def name
  @name
end

#output_actionString? (readonly)

Specifies the action to take when harmful content is detected in the output. Supported values include:.

  • BLOCK – Block the content and replace it with blocked messaging.
  • NONE – Take no action but return detection information in the trace response.


1701
1702
1703
# File 'bedrock/cfn_guardrail.rb', line 1701

def output_action
  @output_action
end

#output_enabledBoolean, ... (readonly)

Specifies whether to enable guardrail evaluation on the output.

When disabled, you aren't charged for the evaluation. The evaluation doesn't appear in the response.



1708
1709
1710
# File 'bedrock/cfn_guardrail.rb', line 1708

def output_enabled
  @output_enabled
end

#typeString (readonly)

Specifies to deny the topic.



1673
1674
1675
# File 'bedrock/cfn_guardrail.rb', line 1673

def type
  @type
end

Class Method Details

.jsii_propertiesObject



1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
# File 'bedrock/cfn_guardrail.rb', line 1710

def self.jsii_properties
  {
    :definition => "definition",
    :name => "name",
    :type => "type",
    :examples => "examples",
    :input_action => "inputAction",
    :input_enabled => "inputEnabled",
    :output_action => "outputAction",
    :output_enabled => "outputEnabled",
  }
end

Instance Method Details

#to_jsiiObject



1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
# File 'bedrock/cfn_guardrail.rb', line 1723

def to_jsii
  result = {}
  result.merge!({
    "definition" => @definition,
    "name" => @name,
    "type" => @type,
    "examples" => @examples,
    "inputAction" => @input_action,
    "inputEnabled" => @input_enabled,
    "outputAction" => @output_action,
    "outputEnabled" => @output_enabled,
  })
  result.compact
end