interface ChatPromptVariantProps
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Bedrock.Alpha.ChatPromptVariantProps |
![]() | github.com/aws/aws-cdk-go/awsbedrockalpha/v2#ChatPromptVariantProps |
![]() | software.amazon.awscdk.services.bedrock.alpha.ChatPromptVariantProps |
![]() | aws_cdk.aws_bedrock_alpha.ChatPromptVariantProps |
![]() | @aws-cdk/aws-bedrock-alpha ยป ChatPromptVariantProps |
Properties for creating a chat prompt variant.
Example
const cmk = new kms.Key(this, 'cmk', {});
const variantChat = bedrock.PromptVariant.chat({
variantName: 'variant1',
model: bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V1_0,
messages: [
bedrock.ChatMessage.user('From now on, you speak Japanese!'),
bedrock.ChatMessage.assistant('Konnichiwa!'),
bedrock.ChatMessage.user('From now on, you speak {{language}}!'),
],
system: 'You are a helpful assistant that only speaks the language you`re told.',
promptVariables: ['language'],
toolConfiguration: {
toolChoice: bedrock.ToolChoice.AUTO,
tools: [
bedrock.Tool.function({
name: 'top_song',
description: 'Get the most popular song played on a radio station.',
inputSchema: {
type: 'object',
properties: {
sign: {
type: 'string',
description: 'The call sign for the radio station for which you want the most popular song. Example calls signs are WZPZ and WKR.',
},
},
required: ['sign'],
},
}),
],
},
});
new bedrock.Prompt(this, 'prompt1', {
promptName: 'prompt-chat',
description: 'my first chat prompt',
defaultVariant: variantChat,
variants: [variantChat],
kmsKey: cmk,
});
Properties
Name | Type | Description |
---|---|---|
messages | Chat [] | The messages in the chat prompt. |
model | IBedrock | The model which is used to run the prompt. |
variant | string | The name of the prompt variant. |
inference | Prompt | Inference configuration for the Chat Prompt. |
prompt | string[] | The variables in the prompt template that can be filled in at runtime. |
system? | string | Context or instructions for the model to consider before generating a response. |
tool | Tool | The configuration with available tools to the model and how it must use them. |
messages
Type:
Chat
[]
The messages in the chat prompt.
Must include at least one User Message. The messages should alternate between User and Assistant.
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.
variantName
Type:
string
The name of the prompt variant.
inferenceConfiguration?
Type:
Prompt
(optional, default: No inference configuration provided.)
Inference configuration for the Chat Prompt.
promptVariables?
Type:
string[]
(optional, default: No variables defined.)
The variables in the prompt template that can be filled in at runtime.
system?
Type:
string
(optional, default: No system message provided.)
Context or instructions for the model to consider before generating a response.
toolConfiguration?
Type:
Tool
(optional, default: No tool configuration provided.)
The configuration with available tools to the model and how it must use them.