PromptProps

class aws_cdk.aws_bedrock_alpha.PromptProps(*, prompt_name, default_variant=None, description=None, kms_key=None, tags=None, variants=None)

Bases: object

(experimental) Properties for creating a CDK managed Bedrock Prompt.

Parameters:
  • prompt_name (str) – (experimental) The name of the prompt. This will be used as the physical name of the prompt. Allowed Pattern: ^([0-9a-zA-Z][_-]?){1,100}$

  • default_variant (Optional[IPromptVariant]) – (experimental) The Prompt Variant that will be used by default. Default: - No default variant provided.

  • description (Optional[str]) – (experimental) A description of what the prompt does. Default: - No description provided. Maximum Length: 200

  • kms_key (Optional[IKey]) – (experimental) The KMS key that the prompt is encrypted with. Default: - AWS owned and managed key.

  • tags (Optional[Mapping[str, str]]) – (experimental) Tags to apply to the prompt. Default: - No tags applied.

  • variants (Optional[Sequence[IPromptVariant]]) – (experimental) 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. Default: - No additional variants provided.

Stability:

experimental

ExampleMetadata:

fixture=default infused

Example:

cmk = kms.Key(self, "cmk")
claude_model = bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_SONNET_V1_0

variant1 = bedrock.PromptVariant.text(
    variant_name="variant1",
    model=claude_model,
    prompt_variables=["topic"],
    prompt_text="This is my first text prompt. Please summarize our conversation on: {{topic}}.",
    inference_configuration=bedrock.PromptInferenceConfiguration.text(
        temperature=1,
        top_p=0.999,
        max_tokens=2000
    )
)

prompt1 = bedrock.Prompt(self, "prompt1",
    prompt_name="prompt1",
    description="my first prompt",
    default_variant=variant1,
    variants=[variant1],
    kms_key=cmk
)

Attributes

default_variant

(experimental) The Prompt Variant that will be used by default.

Default:
  • No default variant provided.

Stability:

experimental

description

(experimental) A description of what the prompt does.

Default:

  • No description provided.

Maximum Length: 200

Stability:

experimental

kms_key

(experimental) The KMS key that the prompt is encrypted with.

Default:
  • AWS owned and managed key.

Stability:

experimental

prompt_name

(experimental) The name of the prompt.

This will be used as the physical name of the prompt. Allowed Pattern: ^([0-9a-zA-Z][_-]?){1,100}$

Stability:

experimental

tags

(experimental) Tags to apply to the prompt.

Default:
  • No tags applied.

Stability:

experimental

variants

(experimental) 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.

Default:
  • No additional variants provided.

Stability:

experimental