ToolChoice

sealed class ToolChoice

Sometimes, you may want chat to be forced to use a tool. Sometimes you may want to prevent chat from using a tool. This sealed class represents all options that can be used with the Chat endpoint.

In general, you should use ToolChoice.Auto unless you have a specific reason not to.

Use the helper methods in the chat request builder:

Inheritors

Types

Link copied to clipboard
data object Auto : ToolChoice

Lets ChatGPT automatically decide whether to use a tool, and which tool to use. This is the default value (when toolChoice is null).

Link copied to clipboard
object Companion
Link copied to clipboard
data class Function(var name: String) : ToolChoice

Forces ChatGPT to use the specified function.

Link copied to clipboard
data object None : ToolChoice

Prevents ChatGPT from using any tool.