Experimental
@aws-cdk/aws-bedrock-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
AgentPromptVariantProps Struct
Properties for creating an agent prompt variant.
Example
ts
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
agentAliasIAgentAliasagent_aliasIAgentAliasagentAliasIAgentAliasAgentAliasIAgentAliasAgentAliasIAgentAliasrequired#An alias pointing to the agent version to be used.
modelIBedrockInvokablemodelIBedrockInvokablemodelIBedrockInvokableModelIBedrockInvokableModelIBedrockInvokablerequired#The model which is used to run the prompt.
The model could be a foundation model, a custom model, or a provisioned model.
The text prompt.
Variables are used by enclosing its name with double curly braces as in {{variable_name}}.
promptVariablesoptionalstring[]prompt_variablesoptionaltyping.List[str]promptVariablesoptionalList<String>PromptVariablesoptionalstring[]PromptVariablesoptional*[]*string#The variables in the prompt template that can be filled in at runtime.
Default: No variables defined.
The name of the prompt variant.