> ## Documentation Index
> Fetch the complete documentation index at: https://openrouter-d02e98a0-mintlify-7021d5f4.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# ToolChoice - Go SDK

> ToolChoice type definition

<Warning>
  The Go SDK and docs are currently in beta.
  Report issues on [GitHub](https://github.com/OpenRouterTeam/go-sdk/issues).
</Warning>

## Supported Types

### ToolChoiceAuto

```go lines theme={null}
toolChoice := components.CreateToolChoiceAuto(components.ToolChoiceAuto{/* values here */})
```

### ToolChoiceAny

```go lines theme={null}
toolChoice := components.CreateToolChoiceAny(components.ToolChoiceAny{/* values here */})
```

### ToolChoiceNone

```go lines theme={null}
toolChoice := components.CreateToolChoiceNone(components.ToolChoiceNone{/* values here */})
```

### ToolChoiceTool

```go lines theme={null}
toolChoice := components.CreateToolChoiceTool(components.ToolChoiceTool{/* values here */})
```

## Union Discrimination

Use the `Type` field to determine which variant is active, then access the corresponding field:

```go lines theme={null}
switch toolChoice.Type {
	case components.ToolChoiceTypeAutoValue:
		// toolChoice.ToolChoiceAuto is populated
	case components.ToolChoiceTypeAny:
		// toolChoice.ToolChoiceAny is populated
	case components.ToolChoiceTypeNone:
		// toolChoice.ToolChoiceNone is populated
	case components.ToolChoiceTypeTool:
		// toolChoice.ToolChoiceTool is populated
}
```
