ToolChoice
- class aws_cdk.aws_bedrock_alpha.ToolChoice(any, auto, tool=None)
- Bases: - object- (experimental) Defines how the model should choose which tool to use. - 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 ) - Parameters:
- any ( - Any)
- auto ( - Any)
- tool ( - Optional[- str])
 
- Stability:
- experimental 
 - Attributes - ANY = <aws_cdk.aws_bedrock_alpha.ToolChoice object>
 - AUTO = <aws_cdk.aws_bedrock_alpha.ToolChoice object>
 - any
- (experimental) Configuration for ANY tool choice. - Stability:
- experimental 
 
 - auto
- (experimental) Configuration for AUTO tool choice. - Stability:
- experimental 
 
 - tool
- (experimental) The specific tool name if using specific tool choice. - Stability:
- experimental 
 
 - Static Methods - classmethod specific_tool(tool_name)
- (experimental) The Model must request the specified tool. - Only supported by some models like Anthropic Claude 3 models. - Parameters:
- tool_name ( - str) –- The name of the specific tool to use. 
 
- Return type:
- Returns:
- A ToolChoice instance configured for the specific tool 
- Stability:
- experimental