java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.stepfunctions.tasks.Guardrail
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.103.1 (build bef2dea)", date="2024-10-05T03:43:52.169Z") @Stability(Stable) public class Guardrail extends software.amazon.jsii.JsiiObject
Guradrail settings for BedrockInvokeModel.

Example:

 import software.amazon.awscdk.services.bedrock.*;
 FoundationModel model = FoundationModel.fromFoundationModelId(this, "Model", FoundationModelIdentifier.AMAZON_TITAN_TEXT_G1_EXPRESS_V1);
 BedrockInvokeModel task = BedrockInvokeModel.Builder.create(this, "Prompt Model with guardrail")
         .model(model)
         .body(TaskInput.fromObject(Map.of(
                 "inputText", "Generate a list of five first names.",
                 "textGenerationConfig", Map.of(
                         "maxTokenCount", 100,
                         "temperature", 1))))
         .guardrail(Guardrail.enable("guardrailId", 1))
         .resultSelector(Map.of(
                 "names", JsonPath.stringAt("$.Body.results[0].outputText")))
         .build();
 
  • Nested Class Summary

    Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject

    software.amazon.jsii.JsiiObject.InitializationMode
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Guardrail(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
     
    protected
    Guardrail(software.amazon.jsii.JsiiObjectRef objRef)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Guardrail
    enable(String identifier, Number version)
    Enable guardrail.
    static Guardrail
    enableDraft(String identifier)
    Enable guardrail with DRAFT version.
    The identitifier of guardrail.
    The version of guardrail.

    Methods inherited from class software.amazon.jsii.JsiiObject

    jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Constructor Details

    • Guardrail

      protected Guardrail(software.amazon.jsii.JsiiObjectRef objRef)
    • Guardrail

      protected Guardrail(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
  • Method Details

    • enable

      @Stability(Stable) @NotNull public static Guardrail enable(@NotNull String identifier, @NotNull Number version)
      Enable guardrail.

      Parameters:
      identifier - The id or arn of the guardrail. This parameter is required.
      version - The version of the guardrail. This parameter is required.
    • enableDraft

      @Stability(Stable) @NotNull public static Guardrail enableDraft(@NotNull String identifier)
      Enable guardrail with DRAFT version.

      Parameters:
      identifier - The identifier of the guardrail. This parameter is required.
    • getGuardrailIdentifier

      @Stability(Stable) @NotNull public String getGuardrailIdentifier()
      The identitifier of guardrail.
    • getGuardrailVersion

      @Stability(Stable) @NotNull public String getGuardrailVersion()
      The version of guardrail.