Tool Calling
Tool & Function Calling - Use tools in your prompts
Tool calling (also known as function calls) give an LLM access to external tools. The LLM does not call the tools directly. Instead, it suggests the tool to call. The user then calls the tool separately and provides the results back to the LLM. Finally, the LLM formats the response into an answer to the user's original question.
Tool calling provides LLMs with a powerful and flexible way to interface with external systems and access data beyond their training set. This guide shows how to connect a model to the data and actions provided by your application.
Tool calling is a multi-turn conversation between your application and the model. The tool calling flow has five main steps:
Send a request to the model, including the tools it can call
Receive tool calls from the model
Execute code on the application side using the tool call inputs
Send a new request to the model, including the tool outputs
Receive the final response from the model (or additional tool calls)

Infron supports tool calling across multiple API protocols:
Use the tools and tool_choice parameters
OpenAI Responses API (Beta)
Use the tools parameter; responses include the function_call type
Anthropic Messages API (Beta)
Use the tools parameter; tool definitions use input_schema
Protocol comparison
Tool parameter name
tools
tools
tools
tools
Schema field
parameters
parameters
input_schema
parameters
Tool call identifier
tool_calls
function_call
tool_use
functionCall
Result field
tool role
function_call_output
tool_result
functionResponse
Parallel calls
✅
✅
✅
✅
Forced calling
tool_choice
tool_choice
tool_choice
functionCallingConfig
Strict mode
strict: true
✅
strict: true
VALIDATED mode
Streaming support
✅
✅
✅
✅
Supported Models: You can find models that support tool calling by filtering on https://infron.ai/models?supported_parameters=tools

If you prefer to learn from a full end-to-end example, keep reading.
OpenAI Chat Completion API
Tool calling example
Let’s look at a complete tool calling flow, using get_horoscope to fetch a daily horoscope for a zodiac sign.
Defining a function tool (function)
Function tools can be configured via the tools parameter. A function tool is defined by its schema, which tells the model what the function does and what input parameters it expects. A function tool definition includes the following fields:
type
Must always be function
function
The tool object
function.name
Function name (e.g., get_weather)
function.description
Detailed information on when and how to use the function
function.parameters
JSON Schema defining the function input parameters
function.strict
Whether to enable strict schema adherence when generating function calls
Below is the definition for a get_weather function tool:
Handling tool calls (Tool calling)
When the model calls a tool in tools, you must execute that tool and return the result. Since tool calling may include zero, one, or multiple calls, best practice is to assume there may be multiple.
Response format
When the model needs to call tools, the response finish_reason is "tool_calls", and message includes a tool_calls array:
Each call in the tool_calls array contains:
id: a unique identifier used when submitting the function result latertype: the tooltype, typicallyfunctionorcustomfunction: the function objectname: the function namearguments: JSON-encoded function arguments
Example tool_calls containing multiple tool calls:
Execute tool calls and append results
Controlling tool calling behavior (tool_choice)
By default, the model decides when and how many tools to call. You can control tool calling behavior using the tool_choice parameter.
Auto: (default) Call zero, one, or multiple tools.
tool_choice: "auto"Required: Call one or more tools.
tool_choice: "required"
When to use (allowed_tools)
If you want the model to use only a subset of the tool list in a given request—without modifying the tool list you pass in, to maximize prompt caching—you can configure allowed_tools.
You can also set tool_choice to "none" to force the model not to call any tools.
Streaming
Streaming tool calling is very similar to streaming normal responses: set stream to true and receive a stream of events.
Output events
When the model calls one or more tools, an event will be emitted for each tool call where tool_calls.type is not empty:
Below is a snippet showing how to aggregate delta values into the final tool_call object.
Accumulate tool_call content
Accumulated final_tool_calls[0]
Last updated