Class Tool
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.bedrock.alpha.Tool
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
@Generated(value="jsii-pacmak/1.112.0 (build de1bc80)",
date="2025-08-06T18:14:48.097Z")
@Stability(Experimental)
public abstract class Tool
extends software.amazon.jsii.JsiiObject
(experimental) Abstract base class for tools that can be used by the model.
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();
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Tool
function
(FunctionToolProps props) (experimental) Creates a function tool.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
Tool
protected Tool(software.amazon.jsii.JsiiObjectRef objRef) -
Tool
protected Tool(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
Tool
@Stability(Experimental) protected Tool()
-
-
Method Details
-
function
(experimental) Creates a function tool.- Parameters:
props
- This parameter is required.
-