One of the following:
type BetaToolChoiceOptions string

Controls which (if any) tool is called by the model.

none means the model will not call any tool and instead generates a message.

auto means the model can pick between generating a message or calling one or more tools.

required means the model must call one or more tools.

One of the following:
const BetaToolChoiceOptionsNone BetaToolChoiceOptions = "none"
const BetaToolChoiceOptionsAuto BetaToolChoiceOptions = "auto"
const BetaToolChoiceOptionsRequired BetaToolChoiceOptions = "required"
type BetaToolChoiceAllowed struct{…}

Constrains the tools available to the model to a pre-defined set.

Mode BetaToolChoiceAllowedMode

Constrains the tools available to the model to a pre-defined set.

auto allows the model to pick from among the allowed tools and generate a message.

required requires the model to call one or more of the allowed tools.

One of the following:
const BetaToolChoiceAllowedModeAuto BetaToolChoiceAllowedMode = "auto"
const BetaToolChoiceAllowedModeRequired BetaToolChoiceAllowedMode = "required"
Tools []map[string, any]

A list of tool definitions that the model should be allowed to call.

For the Responses API, the list of tool definitions might look like:

[
  { "type": "function", "name": "get_weather" },
  { "type": "mcp", "server_label": "deepwiki" },
  { "type": "image_generation" }
]
Type AllowedTools

Allowed tool configuration type. Always allowed_tools.

type BetaToolChoiceTypes struct{…}

Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools.

Type BetaToolChoiceTypesType

The type of hosted tool the model should to use. Learn more about built-in tools.

Allowed values are:

  • file_search
  • web_search_preview
  • computer
  • computer_use_preview
  • computer_use
  • code_interpreter
  • image_generation
One of the following:
const BetaToolChoiceTypesTypeFileSearch BetaToolChoiceTypesType = "file_search"
const BetaToolChoiceTypesTypeWebSearchPreview BetaToolChoiceTypesType = "web_search_preview"
const BetaToolChoiceTypesTypeComputer BetaToolChoiceTypesType = "computer"
const BetaToolChoiceTypesTypeComputerUsePreview BetaToolChoiceTypesType = "computer_use_preview"
const BetaToolChoiceTypesTypeComputerUse BetaToolChoiceTypesType = "computer_use"
const BetaToolChoiceTypesTypeWebSearchPreview2025_03_11 BetaToolChoiceTypesType = "web_search_preview_2025_03_11"
const BetaToolChoiceTypesTypeImageGeneration BetaToolChoiceTypesType = "image_generation"
const BetaToolChoiceTypesTypeCodeInterpreter BetaToolChoiceTypesType = "code_interpreter"
type BetaToolChoiceFunction struct{…}

Use this option to force the model to call a specific function.

Name string

The name of the function to call.

Type Function

For function calling, the type is always function.

type BetaToolChoiceMcp struct{…}

Use this option to force the model to call a specific tool on a remote MCP server.

ServerLabel string

The label of the MCP server to use.

Type Mcp

For MCP tools, the type is always mcp.

Name stringOptional

The name of the tool to call on the server.

type BetaToolChoiceCustom struct{…}

Use this option to force the model to call a specific custom tool.

Name string

The name of the custom tool to call.

Type Custom

For custom tool calling, the type is always custom.

type BetaResponseToolChoiceBetaSpecificProgrammaticToolCallingParam struct{…}
Type ProgrammaticToolCalling

The tool to call. Always programmatic_tool_calling.

type BetaToolChoiceApplyPatch struct{…}

Forces the model to call the apply_patch tool when executing a tool call.

Type ApplyPatch

The tool to call. Always apply_patch.

type BetaToolChoiceShell struct{…}

Forces the model to call the shell tool when a tool call is required.

Type Shell

The tool to call. Always shell.