Class CfnPrompt
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.CfnElement
software.amazon.awscdk.CfnRefElement
software.amazon.awscdk.CfnResource
software.amazon.awscdk.services.bedrock.CfnPrompt
- All Implemented Interfaces:
IInspectable,ITaggableV2,IPromptRef,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.116.0 (build 0eddcff)",
date="2025-10-24T13:34:32.463Z")
@Stability(Stable)
public class CfnPrompt
extends CfnResource
implements IInspectable, IPromptRef, ITaggableV2
Creates a prompt in your prompt library that you can add to a flow.
For more information, see Prompt management in Amazon Bedrock , Create a prompt using Prompt management and Prompt flows in Amazon Bedrock in the Amazon Bedrock User Guide.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.bedrock.*;
Object additionalModelRequestFields;
Object any;
Object auto;
Object json;
CfnPrompt cfnPrompt = CfnPrompt.Builder.create(this, "MyCfnPrompt")
.name("name")
// the properties below are optional
.customerEncryptionKeyArn("customerEncryptionKeyArn")
.defaultVariant("defaultVariant")
.description("description")
.tags(Map.of(
"tagsKey", "tags"))
.variants(List.of(PromptVariantProperty.builder()
.name("name")
.templateConfiguration(PromptTemplateConfigurationProperty.builder()
.chat(ChatPromptTemplateConfigurationProperty.builder()
.messages(List.of(MessageProperty.builder()
.content(List.of(ContentBlockProperty.builder()
.cachePoint(CachePointBlockProperty.builder()
.type("type")
.build())
.text("text")
.build()))
.role("role")
.build()))
// the properties below are optional
.inputVariables(List.of(PromptInputVariableProperty.builder()
.name("name")
.build()))
.system(List.of(SystemContentBlockProperty.builder()
.cachePoint(CachePointBlockProperty.builder()
.type("type")
.build())
.text("text")
.build()))
.toolConfiguration(ToolConfigurationProperty.builder()
.tools(List.of(ToolProperty.builder()
.cachePoint(CachePointBlockProperty.builder()
.type("type")
.build())
.toolSpec(ToolSpecificationProperty.builder()
.inputSchema(ToolInputSchemaProperty.builder()
.json(json)
.build())
.name("name")
// the properties below are optional
.description("description")
.build())
.build()))
// the properties below are optional
.toolChoice(ToolChoiceProperty.builder()
.any(any)
.auto(auto)
.tool(SpecificToolChoiceProperty.builder()
.name("name")
.build())
.build())
.build())
.build())
.text(TextPromptTemplateConfigurationProperty.builder()
.cachePoint(CachePointBlockProperty.builder()
.type("type")
.build())
.inputVariables(List.of(PromptInputVariableProperty.builder()
.name("name")
.build()))
.text("text")
.textS3Location(TextS3LocationProperty.builder()
.bucket("bucket")
.key("key")
// the properties below are optional
.version("version")
.build())
.build())
.build())
.templateType("templateType")
// the properties below are optional
.additionalModelRequestFields(additionalModelRequestFields)
.genAiResource(PromptGenAiResourceProperty.builder()
.agent(PromptAgentResourceProperty.builder()
.agentIdentifier("agentIdentifier")
.build())
.build())
.inferenceConfiguration(PromptInferenceConfigurationProperty.builder()
.text(PromptModelInferenceConfigurationProperty.builder()
.maxTokens(123)
.stopSequences(List.of("stopSequences"))
.temperature(123)
.topP(123)
.build())
.build())
.metadata(List.of(PromptMetadataEntryProperty.builder()
.key("key")
.value("value")
.build()))
.modelId("modelId")
.build()))
.build();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA fluent builder forCfnPrompt.static interfaceDefines a section of content to be cached for reuse in subsequent API calls.static interfaceContains configurations to use a prompt in a conversational format.static interfaceA block of content for a message that you pass to, or receive from, a model with the Converse or ConverseStream API operations.static interfaceA message input, or returned from, a call to Converse or ConverseStream .static interfaceContains specifications for an Amazon Bedrock agent with which to use the prompt.static interfaceContains specifications for a generative AI resource with which to use the prompt.static interfaceContains inference configurations for the prompt.static interfaceContains information about a variable in the prompt.static interfaceContains a key-value pair that defines a metadata tag and value to attach to a prompt variant.static interfaceContains inference configurations related to model inference for a prompt.static interfaceContains the message for a prompt.static interfaceContains details about a variant of the prompt.static interfaceThe model must request a specific tool.static interfaceContains configurations for instructions to provide the model for how to handle input.static interfaceContains configurations for a text prompt template.static interfaceThe Amazon S3 location of the prompt text.static interfaceDetermines which tools the model should request in a call toConverseorConverseStream.static interfaceConfiguration information for the tools that you pass to a model.static interfaceThe schema for the tool.static interfaceInformation about a tool that you can use with the Converse API.static interfaceThe specification for the tool.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.services.bedrock.IPromptRef
IPromptRef.Jsii$Default, IPromptRef.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.ITaggableV2
ITaggableV2.Jsii$Default, ITaggableV2.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCfnPrompt(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnPrompt(software.amazon.jsii.JsiiObjectRef objRef) CfnPrompt(software.constructs.Construct scope, String id, CfnPromptProps props) -
Method Summary
Modifier and TypeMethodDescriptionThe Amazon Resource Name (ARN) of the prompt or the prompt version (if you specified a version in the request).The time at which the prompt was created.The unique identifier of the prompt.The time at which the prompt was last updated.The version of the prompt that this summary applies to.Tag Manager which manages the tags for this resource.The Amazon Resource Name (ARN) of the KMS key that the prompt is encrypted with.The name of the default variant for the prompt.The description of the prompt.getName()The name of the prompt.A reference to a Prompt resource.getTags()Metadata that you can assign to a resource as key-value pairs.A list of objects, each containing details about a variant of the prompt.voidinspect(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties(Map<String, Object> props) voidThe Amazon Resource Name (ARN) of the KMS key that the prompt is encrypted with.voidsetDefaultVariant(String value) The name of the default variant for the prompt.voidsetDescription(String value) The description of the prompt.voidThe name of the prompt.voidMetadata that you can assign to a resource as key-value pairs.voidsetVariants(List<Object> value) A list of objects, each containing details about a variant of the prompt.voidsetVariants(IResolvable value) A list of objects, each containing details about a variant of the prompt.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validatePropertiesMethods inherited from class software.amazon.awscdk.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdMethods inherited from class software.constructs.Construct
getNode, isConstructMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnPrompt
protected CfnPrompt(software.amazon.jsii.JsiiObjectRef objRef) -
CfnPrompt
protected CfnPrompt(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnPrompt
@Stability(Stable) public CfnPrompt(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnPromptProps props) - Parameters:
scope- Scope in which this resource is defined. This parameter is required.id- Construct identifier for this resource (unique in its scope). This parameter is required.props- Resource properties. This parameter is required.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspectin interfaceIInspectable- Parameters:
inspector- tree inspector to collect and process attributes. This parameter is required.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderPropertiesin classCfnResource- Parameters:
props- This parameter is required.
-
getAttrArn
The Amazon Resource Name (ARN) of the prompt or the prompt version (if you specified a version in the request). -
getAttrCreatedAt
The time at which the prompt was created. -
getAttrId
The unique identifier of the prompt. -
getAttrUpdatedAt
The time at which the prompt was last updated. -
getAttrVersion
The version of the prompt that this summary applies to. -
getCdkTagManager
Tag Manager which manages the tags for this resource.- Specified by:
getCdkTagManagerin interfaceITaggableV2
-
getCfnProperties
- Overrides:
getCfnPropertiesin classCfnResource
-
getPromptRef
A reference to a Prompt resource.- Specified by:
getPromptRefin interfaceIPromptRef
-
getName
The name of the prompt. -
setName
The name of the prompt. -
getCustomerEncryptionKeyArn
The Amazon Resource Name (ARN) of the KMS key that the prompt is encrypted with. -
setCustomerEncryptionKeyArn
The Amazon Resource Name (ARN) of the KMS key that the prompt is encrypted with. -
getDefaultVariant
The name of the default variant for the prompt. -
setDefaultVariant
The name of the default variant for the prompt. -
getDescription
The description of the prompt. -
setDescription
The description of the prompt. -
getTags
Metadata that you can assign to a resource as key-value pairs.For more information, see the following resources:.
-
setTags
Metadata that you can assign to a resource as key-value pairs.For more information, see the following resources:.
-
getVariants
A list of objects, each containing details about a variant of the prompt.Returns union: either
IResolvableor Listinvalid input: '<'eitherIResolvableorCfnPrompt.PromptVariantProperty> -
setVariants
A list of objects, each containing details about a variant of the prompt. -
setVariants
A list of objects, each containing details about a variant of the prompt.
-