Friendli supports tool calling for a wide range of open‑source and commercial models.
tools
, tool_choice
, and parallel_tool_calls
parameters.
Parameter | Description | default |
---|---|---|
tools | The list of tool objects that define the functions the model can call. | - |
tool_choice | Determines the tool calling behavior of the model. | auto |
parallel_tool_calls | Whether to let the model issue tool calls in parallel. | True |
tool_choice
parameter, you can explicitly instruct the model to use a specific function.
none
: Disable the use of tools.auto
: Enable the model to decide whether to use tools and which ones to use.required
: Force the model to use a tool, but the model chooses which one.choices[].message.tool_calls[]
with each item containing a function.name
and JSON‑stringified function.arguments
. After executing a tool, append a new message with role: tool
, the matching tool_call_id
, and the tool result in content.
get_weather
) that retrieves weather information.
Tool Definition
get_weather
) with a JSON Schema.location
: The location to look up weather information for.date
: The date to look up weather information for.tools
array and passed to the model.Calling the model
messages
array.tools
and messages
defined above.Execution tool
get_weather
function is executed as follows:Adding tool responses
messages
array and pass it back to the model.Generating the final response