class PromptVersion (construct)
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Bedrock.Alpha.PromptVersion |
![]() | github.com/aws/aws-cdk-go/awsbedrockalpha/v2#PromptVersion |
![]() | software.amazon.awscdk.services.bedrock.alpha.PromptVersion |
![]() | aws_cdk.aws_bedrock_alpha.PromptVersion |
![]() | @aws-cdk/aws-bedrock-alpha ยป PromptVersion |
Implements
IConstruct
, IDependable
Class to create a Prompt Version with CDK.
Creates a version of the prompt. Use this to create a static snapshot of your prompt that can be deployed to production. Versions allow you to easily switch between different configurations for your prompt and update your application with the most appropriate version for your use-case.
Example
const cmk = new kms.Key(this, 'cmk', {});
const claudeModel = bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_SONNET_V1_0;
const variant1 = bedrock.PromptVariant.text({
variantName: 'variant1',
model: claudeModel,
promptVariables: ['topic'],
promptText: 'This is my first text prompt. Please summarize our conversation on: {{topic}}.',
inferenceConfiguration: bedrock.PromptInferenceConfiguration.text({
temperature: 1.0,
topP: 0.999,
maxTokens: 2000,
}),
});
const prompt1 = new bedrock.Prompt(this, 'prompt1', {
promptName: 'prompt1',
description: 'my first prompt',
defaultVariant: variant1,
variants: [variant1],
kmsKey: cmk,
});
const promptVersion = new bedrock.PromptVersion(this, 'MyPromptVersion', {
prompt: prompt1,
description: 'my first version',
});
//or alternatively:
// const promptVersion = prompt1.createVersion('my first version');
const versionString = promptVersion.version;
Initializer
new PromptVersion(scope: Construct, id: string, props: PromptVersionProps)
Parameters
- scope
Construct
- id
string
- props
Prompt
Version Props
**************************************************************************** CONSTRUCTOR ***************************************************************************.
Construct Props
Name | Type | Description |
---|---|---|
prompt | IPrompt | The prompt to use for this version. |
description? | string | The description of the prompt version. |
prompt
Type:
IPrompt
The prompt to use for this version.
description?
Type:
string
(optional, default: No description provided.
Maximum length: 200)
The description of the prompt version.
Properties
Name | Type | Description |
---|---|---|
node | Node | The tree node. |
prompt | IPrompt | The prompt used by this version. |
version | string | The version of the prompt that was created. |
version | string | The Amazon Resource Name (ARN) of the prompt version. |
description? | string | The description of the prompt version. |
node
Type:
Node
The tree node.
prompt
Type:
IPrompt
The prompt used by this version.
version
Type:
string
The version of the prompt that was created.
versionArn
Type:
string
The Amazon Resource Name (ARN) of the prompt version. Example
"arn:aws:bedrock:us-east-1:123456789012:prompt/PROMPT12345:1"
description?
Type:
string
(optional)
The description of the prompt version.
Methods
Name | Description |
---|---|
to | Returns a string representation of this construct. |
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.