Skip to content
v2.278.0

ToolChoiceProperty Struct ​

Determines which tools the model should request in a call to Converse or ConverseStream .

For more information, see Call a tool with the Converse API in the Amazon Bedrock User Guide.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_bedrock as bedrock } from 'aws-cdk-lib';

declare const any: any;
declare const auto: any;
const toolChoiceProperty: bedrock.CfnPromptVersion.ToolChoiceProperty = {
  any: any,
  auto: auto,
  tool: {
    name: 'name',
  },
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_bedrock as bedrock

# any: Any
# auto: Any

tool_choice_property = bedrock.CfnPromptVersion.ToolChoiceProperty(
    any=any,
    auto=auto,
    tool=bedrock.CfnPromptVersion.SpecificToolChoiceProperty(
        name="name"
    )
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.bedrock.*;

Object any;
Object auto;

ToolChoiceProperty toolChoiceProperty = ToolChoiceProperty.builder()
        .any(any)
        .auto(auto)
        .tool(SpecificToolChoiceProperty.builder()
                .name("name")
                .build())
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Bedrock;

var any;
var auto;

var toolChoiceProperty = new ToolChoiceProperty {
    Any = any,
    Auto = auto,
    Tool = new SpecificToolChoiceProperty {
        Name = "name"
    }
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var any interface{}
var auto interface{}

toolChoiceProperty := &ToolChoiceProperty{
	Any: any,
	Auto: auto,
	Tool: &SpecificToolChoiceProperty{
		Name: jsii.String("name"),
	},
}

Properties ​

anyoptionalanyanyoptionalAnyanyoptionalObjectAnyoptionalobjectAnyoptionalinterface{} #
The model must request at least one tool (no text is generated).
autooptionalanyautooptionalAnyautooptionalObjectAutooptionalobjectAutooptionalinterface{} #
(Default).

The Model automatically decides if a tool should be called or whether to generate text instead.

tooloptionalIResolvable | CfnPromptVersion.SpecificToolChoicePropertytooloptionaltyping.Union[IResolvable, SpecificToolChoiceProperty]tooloptionalIResolvableTooloptionalIResolvableTooloptionalinterface{} #
The Model must request the specified tool.

Only supported by Anthropic Claude 3 and Amazon Nova models.