OpenAIToolChoice

@Serializable(with = OpenAIToolChoiceSerializer::class)
sealed interface OpenAIToolChoice

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

  • Auto lets the model pick between generating a message or calling one or more tools.

  • None forces the model to generate a message without calling tools.

  • Required forces the model to call one or more tools.

  • Function forces the model to call a specific function tool.

none is the default when no tools are present, auto is the default when tools are present.

See also

Inheritors

Types

Link copied to clipboard
data object Auto : OpenAIToolChoice

The model can pick between generating a message or calling tools.

Link copied to clipboard
data class Function(val name: String) : OpenAIToolChoice

Forces the model to call a specific function tool.

Link copied to clipboard
data object None : OpenAIToolChoice

The model will not call any tool and instead generates a message.

Link copied to clipboard

The model must call one or more tools.