# ToolChoiceProperty

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](https://docs.aws.amazon.com/bedrock/latest/userguide/tool-use.html) in the Amazon Bedrock User Guide.

- Source: Generated at build time
- Type last changed: v2.177.0 · 25 Jan 2025

## Example

TypeScript:

```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:

```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:

```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();
```

C# / .NET:

```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"
    }
};
```

Golang:

```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

- `any`: any — The model must request at least one tool (no text is generated).

- `auto`: any — (Default).

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

- `tool`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnPromptVersion.SpecificToolChoiceProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_bedrock.CfnPromptVersion.SpecificToolChoiceProperty.html) — The Model must request the specified tool.

  Only supported by Anthropic Claude 3 and Amazon Nova models.
