interface PromptProps
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Bedrock.Alpha.PromptProps |
![]() | github.com/aws/aws-cdk-go/awsbedrockalpha/v2#PromptProps |
![]() | software.amazon.awscdk.services.bedrock.alpha.PromptProps |
![]() | aws_cdk.aws_bedrock_alpha.PromptProps |
![]() | @aws-cdk/aws-bedrock-alpha ยป PromptProps |
Properties for creating a CDK managed Bedrock Prompt.
Example
const cmk = new kms.Key(this, 'cmk', {});
// Assuming you have an existing agent and alias
const agent = bedrock.Agent.fromAgentAttributes(this, 'ImportedAgent', {
agentArn: 'arn:aws:bedrock:region:account:agent/agent-id',
roleArn: 'arn:aws:iam::account:role/agent-role',
});
const agentAlias = bedrock.AgentAlias.fromAttributes(this, 'ImportedAlias', {
aliasId: 'alias-id',
aliasName: 'my-alias',
agentVersion: '1',
agent: agent,
});
const agentVariant = bedrock.PromptVariant.agent({
variantName: 'agent-variant',
model: bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V1_0,
agentAlias: agentAlias,
promptText: 'Use the agent to help with: {{task}}. Please be thorough and provide detailed explanations.',
promptVariables: ['task'],
});
new bedrock.Prompt(this, 'agentPrompt', {
promptName: 'agent-prompt',
description: 'Prompt for agent interactions',
defaultVariant: agentVariant,
variants: [agentVariant],
kmsKey: cmk,
});
Properties
Name | Type | Description |
---|---|---|
prompt | string | The name of the prompt. |
default | IPrompt | The Prompt Variant that will be used by default. |
description? | string | A description of what the prompt does. |
kms | IKey | The KMS key that the prompt is encrypted with. |
tags? | { [string]: string } | Tags to apply to the prompt. |
variants? | IPrompt [] | The variants of your prompt. |
promptName
Type:
string
The name of the prompt.
This will be used as the physical name of the prompt. Allowed Pattern: ^([0-9a-zA-Z][_-]?){1,100}$
defaultVariant?
Type:
IPrompt
(optional, default: No default variant provided.)
The Prompt Variant that will be used by default.
description?
Type:
string
(optional, default: No description provided.
Maximum Length: 200)
A description of what the prompt does.
kmsKey?
Type:
IKey
(optional, default: AWS owned and managed key.)
The KMS key that the prompt is encrypted with.
tags?
Type:
{ [string]: string }
(optional, default: No tags applied.)
Tags to apply to the prompt.
variants?
Type:
IPrompt
[]
(optional, default: No additional variants provided.)
The variants of your prompt.
Variants can use different messages, models, or configurations so that you can compare their outputs to decide the best variant for your use case. Maximum of 1 variants.