- Broad model coverage: Works across most chat‑capable models. No custom parsers required.
- High accuracy: Ensures reliable tool-call response that aligns with your provided schemas.
What is Tool Calling?
Tool calling (also called function calling) connects LLMs to external systems, enabling real‑time data access and action execution—capability essential for agentic workflows.
Broad Model Coverage
Friendli supports tool calling for a wide range of open‑source and commercial models.You can browse available models on our Models page and try them out with the Playground.
Tool Calling with Friendli
Friendli supports tool calling for a wide range of open‑source and commercial models.Tool Calling Parameters
To enable tool calling, use thetools
, 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.- Named tool choice: Force the model to use a specific tool. It must be in the following format:
Response Schema
Friendli follows the OpenAI function calling schema. Tool calls are returned inchoices[].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.
Simple Example
The example below walks through five steps:-
Define a tool (
get_weather
) that retrieves weather information. - Ask a question that triggers tool use.
- Let the model select the tool.
- Execute the tool.
- Generate the final answer using the tool result.
1
Tool Definition
Define a function that the model can call (
The function requires the following parameters:
get_weather
) with a JSON Schema.The function requires the following parameters:
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.2
Calling the model
When a user asks a question, this request is passed to the model as a
For example, the request “What’s the weather like in Paris today?” would be passed as:Call the model using the
messages
array.For example, the request “What’s the weather like in Paris today?” would be passed as:
tools
and messages
defined above.3
Execution tool
The API caller runs the tool based on the function call information of the model.
For example, the
For example, the
get_weather
function is executed as follows:Result:
4
Adding tool responses
Add the tool’s response to the
messages
array and pass it back to the model.- Append tool call information
- Append the tool’s execution result
5
Generating the final response
The model generates the final response based on the tool’s output:
Final output:
Advanced Examples
Follow the following blog posts to learn more about how to use tool calling with Friendli:- Building an AI Agent for Google Calendar ( / )
- Friendli Tools Blog Series ( / / )