Tool
- class aws_cdk.aws_bedrock_alpha.Tool
Bases:
object
(experimental) Abstract base class for tools that can be used by the model.
- Stability:
experimental
- ExampleMetadata:
fixture=default infused
Example:
cmk = kms.Key(self, "cmk") variant_chat = bedrock.PromptVariant.chat( variant_name="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.", prompt_variables=["language"], tool_configuration=bedrock.ToolConfiguration( tool_choice=bedrock.ToolChoice.AUTO, tools=[ bedrock.Tool.function( name="top_song", description="Get the most popular song played on a radio station.", input_schema={ "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"] } ) ] ) ) bedrock.Prompt(self, "prompt1", prompt_name="prompt-chat", description="my first chat prompt", default_variant=variant_chat, variants=[variant_chat], kms_key=cmk )
- Stability:
experimental
Static Methods
- classmethod function(*, description, input_schema, name)
(experimental) Creates a function tool.
- Parameters:
description (
str
) – (experimental) A description of what the function does.input_schema (
Any
) – (experimental) The input schema for the function parameters.name (
str
) – (experimental) The name of the function.
- Stability:
experimental
- Return type: