> ## Documentation Index
> Fetch the complete documentation index at: https://openrouter.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# ToolChoice

## Supported Types

### ToolChoiceAuto

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

### ToolChoiceAny

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

### ToolChoiceNone

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

### ToolChoiceTool

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