Interface ChatPromptVariantProps

All Superinterfaces:
CommonPromptVariantProps, software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
ChatPromptVariantProps.Jsii$Proxy

@Generated(value="jsii-pacmak/1.112.0 (build de1bc80)", date="2025-08-05T19:18:43.771Z") @Stability(Experimental) public interface ChatPromptVariantProps extends software.amazon.jsii.JsiiSerializable, CommonPromptVariantProps
(experimental) Properties for creating a chat prompt variant.

Example:

 Key cmk = Key.Builder.create(this, "cmk").build();
 IPromptVariant variantChat = PromptVariant.chat(ChatPromptVariantProps.builder()
         .variantName("variant1")
         .model(BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V1_0)
         .messages(List.of(ChatMessage.user("From now on, you speak Japanese!"), ChatMessage.assistant("Konnichiwa!"), ChatMessage.user("From now on, you speak {{language}}!")))
         .system("You are a helpful assistant that only speaks the language you`re told.")
         .promptVariables(List.of("language"))
         .toolConfiguration(ToolConfiguration.builder()
                 .toolChoice(ToolChoice.AUTO)
                 .tools(List.of(Tool.function(FunctionToolProps.builder()
                         .name("top_song")
                         .description("Get the most popular song played on a radio station.")
                         .inputSchema(Map.of(
                                 "type", "object",
                                 "properties", Map.of(
                                         "sign", Map.of(
                                                 "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", List.of("sign")))
                         .build())))
                 .build())
         .build());
 Prompt.Builder.create(this, "prompt1")
         .promptName("prompt-chat")
         .description("my first chat prompt")
         .defaultVariant(variantChat)
         .variants(List.of(variantChat))
         .kmsKey(cmk)
         .build();
 
  • Method Details

    • getMessages

      @Stability(Experimental) @NotNull List<ChatMessage> getMessages()
      (experimental) The messages in the chat prompt.

      Must include at least one User Message. The messages should alternate between User and Assistant.

    • getInferenceConfiguration

      @Stability(Experimental) @Nullable default PromptInferenceConfiguration getInferenceConfiguration()
      (experimental) Inference configuration for the Chat Prompt.

      Default: - No inference configuration provided.

    • getSystem

      @Stability(Experimental) @Nullable default String getSystem()
      (experimental) Context or instructions for the model to consider before generating a response.

      Default: - No system message provided.

    • getToolConfiguration

      @Stability(Experimental) @Nullable default ToolConfiguration getToolConfiguration()
      (experimental) The configuration with available tools to the model and how it must use them.

      Default: - No tool configuration provided.

    • builder

      @Stability(Experimental) static ChatPromptVariantProps.Builder builder()
      Returns:
      a ChatPromptVariantProps.Builder of ChatPromptVariantProps