get_city_population
function using JSON Schema. This information is provided through the tools
argument. The user query is sent as usual through the messages
argument.get_city_population
tool with a specific argument. Note that the model itself does not invoke the tool. It just specifies the argument. When the model issues a function call, the completion reason will be set to tool_calls
. The API caller is responsible for parsing the function name and arguments supplied by the model and invoking the appropriate tool.get_financial_data
function. We detail its purpose, arguments, etc in JSON Schema. We send this information in through the tools
argument. We send the user query as usual through the messages
argument.get_financial_data
with some specific set of arguments. Again note that the model itself won’t invoke the tool — it just specifies the arguments. When the model issues a function call, the completion reason will be set to tool_calls
. The API caller is responsible for parsing the function name and arguments supplied by the model and invoking the appropriate tool.tools
field is an array where each component includes the following fields:
type
(string
) Specifies the type of the tool. Currently, only function
is supported.function
(object
) Specifies the function to be called. It includes the following fields:
description
(string
): A description of what the function does, used by the model to choose when and how to call the function.name
(string
): The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.parameters
(object
): The parameters the functions accepts, described as a JSON Schema object. See the JSON Schema reference for documentation about the format.tool_choice
parameter controls whether the model is allowed to call functions or not. Currently, we support auto
, none
, any
or a specific function name.
auto
(default)
The model can dynamically choose between generating a message or calling a function. This is the default tool choice when no value is specified for tool_choice
.none
Disables the use of any tools, similar to not specifying the tool_choice
field.any
Allows the model to call any function. You can also specify:tool_choice
field. For example:get_financial_data
function.