Class Prompt
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.bedrock.alpha.PromptBase
software.amazon.awscdk.services.bedrock.alpha.Prompt
- All Implemented Interfaces:
IResource
,IPrompt
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.112.0 (build de1bc80)",
date="2025-07-24T11:33:25.552Z")
@Stability(Experimental)
public class Prompt
extends PromptBase
implements IPrompt
(experimental) Class to create (or import) a Prompt with CDK.
Prompts are a specific set of inputs that guide Foundation Models (FMs) on Amazon Bedrock to generate an appropriate response or output for a given task or instruction. You can optimize the prompt for specific use cases and models.
Example:
Key cmk = Key.Builder.create(this, "cmk").build(); BedrockFoundationModel claudeModel = BedrockFoundationModel.ANTHROPIC_CLAUDE_SONNET_V1_0; IPromptVariant variant1 = PromptVariant.text(TextPromptVariantProps.builder() .variantName("variant1") .model(claudeModel) .promptVariables(List.of("topic")) .promptText("This is my first text prompt. Please summarize our conversation on: {{topic}}.") .inferenceConfiguration(PromptInferenceConfiguration.text(PromptInferenceConfigurationProps.builder() .temperature(1) .topP(0.999) .maxTokens(2000) .build())) .build()); Prompt prompt1 = Prompt.Builder.create(this, "prompt1") .promptName("prompt1") .description("my first prompt") .defaultVariant(variant1) .variants(List.of(variant1)) .kmsKey(cmk) .build();
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.bedrock.alpha.IPrompt
IPrompt.Jsii$Default, IPrompt.Jsii$Proxy
Nested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
(experimental) Uniquely identifies this class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Prompt
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
Prompt
(software.amazon.jsii.JsiiObjectRef objRef) Prompt
(software.constructs.Construct scope, String id, PromptProps props) (experimental) **************************************************************************** CONSTRUCTOR ***************************************************************************. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addVariant
(IPromptVariant variant) (experimental) Adds a prompt variant to the prompt.(experimental) Creates a prompt version, a static snapshot of your prompt that can be deployed to production.createVersion
(String description) (experimental) Creates a prompt version, a static snapshot of your prompt that can be deployed to production.static IPrompt
fromPromptAttributes
(software.constructs.Construct scope, String id, PromptAttributes attrs) (experimental) Creates a Prompt reference from an existing prompt's attributes.(experimental) The description of the prompt.(experimental) The KMS key that the prompt is encrypted with.(experimental) The ARN of the prompt.(experimental) The ID of the prompt.(experimental) The name of the prompt.(experimental) The version of the prompt.(experimental) The variants of the prompt.Methods inherited from class software.amazon.awscdk.services.bedrock.alpha.PromptBase
grantGet
Methods inherited from class software.amazon.awscdk.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResource
Methods inherited from class software.constructs.Construct
getNode, isConstruct, toString
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, wait, wait, wait
Methods inherited from interface software.constructs.IConstruct
getNode
Methods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getEnv, getStack
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
PROPERTY_INJECTION_ID
(experimental) Uniquely identifies this class.
-
-
Constructor Details
-
Prompt
protected Prompt(software.amazon.jsii.JsiiObjectRef objRef) -
Prompt
protected Prompt(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
Prompt
@Stability(Experimental) public Prompt(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull PromptProps props) (experimental) **************************************************************************** CONSTRUCTOR ***************************************************************************.- Parameters:
scope
- This parameter is required.id
- This parameter is required.props
- This parameter is required.
-
-
Method Details
-
fromPromptAttributes
@Stability(Experimental) @NotNull public static IPrompt fromPromptAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull PromptAttributes attrs) (experimental) Creates a Prompt reference from an existing prompt's attributes.Default: - For attrs.promptVersion: 'DRAFT' if no explicit version is provided
- Parameters:
scope
-- The construct scope.
id
-- Identifier of the construct.
attrs
-- Attributes of the existing prompt.
- Returns:
- An IPrompt reference to the existing prompt
-
addVariant
(experimental) Adds a prompt variant to the prompt.- Parameters:
variant
-- The prompt variant to add.
-
createVersion
(experimental) Creates a prompt version, a static snapshot of your prompt that can be deployed to production.Default: - No description provided
- Parameters:
description
-- Optional description for the version.
- Returns:
- A PromptVersion object containing the version details including ARN and version string
-
createVersion
(experimental) Creates a prompt version, a static snapshot of your prompt that can be deployed to production.Default: - No description provided
- Returns:
- A PromptVersion object containing the version details including ARN and version string
-
getPromptArn
(experimental) The ARN of the prompt.Example:
"arn:aws:bedrock:us-east-1:123456789012:prompt/PROMPT12345";
- Specified by:
getPromptArn
in interfaceIPrompt
- Specified by:
getPromptArn
in classPromptBase
-
getPromptId
(experimental) The ID of the prompt.Example:
"PROMPT12345";
- Specified by:
getPromptId
in interfaceIPrompt
- Specified by:
getPromptId
in classPromptBase
-
getPromptName
(experimental) The name of the prompt. -
getPromptVersion
(experimental) The version of the prompt.- Specified by:
getPromptVersion
in interfaceIPrompt
- Specified by:
getPromptVersion
in classPromptBase
-
getVariants
(experimental) The variants of the prompt. -
getDescription
(experimental) The description of the prompt. -
getKmsKey
(experimental) The KMS key that the prompt is encrypted with.- Specified by:
getKmsKey
in interfaceIPrompt
- Specified by:
getKmsKey
in classPromptBase
-