Introduction
Similar to the OpenAI tool use (a.k.a function calling), Empower offers models that are fine-tuned for working with functions, capable of determining when and how a function should be called. If your request includes one or more functions, the model assesses whether any of them should be activated based on the prompt’s context. When the model decides that a function should be called, it responds with a JSON object containing the arguments for that function.
To ensure optimal outcomes from the model, we acknowledge the limitations of our current version. Please note that we are actively working on iterating and improving the model, contact us if any of them blocks your use case:
- Nested function calling: This refers to scenarios where the result of one function depends on another, for example, getWeather(getCurrentLocation()). The model does not currently specialize in handling nested function calls.
- Number of functions: We optimized the model for up to 10 functions in the
"tool_call"
, expect some performance degrade if there are more than 10 functions.- Deeply Nested Argument Schema: We have optimized the model for up to one layer of nesting in the arguments. This means if your arguments include an object or dictionary, we recommend that its value be of a scalar type (number, string, boolean, etc.). Expect some performance degradation if the arguments contain objects within objects.
- Set a very low temperature as possible for the best performance.
How to Use
Supported models
Only models that support tools can utilize the feature. To determine if a model supports tool use, look for the tag next to the model’s name. We have a “TOOLS” tag next to the model name for models that support tool use. See the example below:
General flow
A general process for invoking the tool’s capabilities involves the following steps:
- Invoke the model with the user’s query and a collection of functions in the
tools
parameter and optionally set thetool_choice
parameter to set the mode. - The model may decide to execute one or more functions; in such instances, the output will be a stringified JSON object that follows your specified schema (note: the model might introduce fictional parameters).
- Convert the string back into JSON in your code, and if provided, execute your function with the given arguments.
- Invoke the model again, including the response from the function as a new message, allowing the model to summarize and present the results to the user.
tools
parameter
This parameter specifies a list of tools the model can utilize. Currently, only functions are recognized as tools. Use it to define a list of functions for which the model may generate JSON inputs. A maximum of 128 functions are supported. See the api reference for detailed schema.
tool_choice
parameter
This parameter governs the model’s function-calling behavior, with the following three possible values:
"auto"
: This means the model can choose between generating a message or calling a function."none"
: The model will not call a function and will instead generate a message."any"
: The model is compelled to trigger functions, even when it may not be relevant. In such cases, the most relevant function available will be activated.
Code Example
Below is a code example of the full flow described above with with a single function triggered:
Output
Advanced Use Cases
Besides the basic single turn use case as the example above. Empower tool use models also supports more advanced use case such as tools streaming, multi-turn tool use and parallel tool use. See other docs under “Tool Using” section for more details.