interface AgentPromptVariantProps
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Bedrock.Alpha.AgentPromptVariantProps |
![]() | github.com/aws/aws-cdk-go/awsbedrockalpha/v2#AgentPromptVariantProps |
![]() | software.amazon.awscdk.services.bedrock.alpha.AgentPromptVariantProps |
![]() | aws_cdk.aws_bedrock_alpha.AgentPromptVariantProps |
![]() | @aws-cdk/aws-bedrock-alpha ยป AgentPromptVariantProps |
Properties for creating an agent prompt variant.
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 |
---|---|---|
agent | IAgent | An alias pointing to the agent version to be used. |
model | IBedrock | The model which is used to run the prompt. |
prompt | string | The text prompt. |
variant | string | The name of the prompt variant. |
prompt | string[] | The variables in the prompt template that can be filled in at runtime. |
agentAlias
Type:
IAgent
An alias pointing to the agent version to be used.
model
Type:
IBedrock
The model which is used to run the prompt.
The model could be a foundation model, a custom model, or a provisioned model.
promptText
Type:
string
The text prompt.
Variables are used by enclosing its name with double curly braces
as in {{variable_name}}
.
variantName
Type:
string
The name of the prompt variant.
promptVariables?
Type:
string[]
(optional, default: No variables defined.)
The variables in the prompt template that can be filled in at runtime.