Using function calling
The Continue from conversation history endpoint allows you to use function calling in your applications.
To use function calling, add your functions in the optional tools parameter in your request. They are added to the prompt according to the model's chat template (usually to the system prompt) and processed by the model.
When the model makes a tool call, by default it is streamed back as raw text, and the exact format depends on the model: different models emit different shapes (for example, a <tool_call>{...}</tool_call< block, or a <function=...> style). The format is decided by the model you load. For a single, consistent parsed result regardless of the model, set parse_tool_calls to true (see "Structured tool calls" below).
Paddler validates each parsed tool call's arguments against the JSON Schema you provide in the function's parameters.
Let's take a look at a few examples of using function calling.
Get weather example
Payload
Response
<tool_call>
{
"name": "get_weather",
"arguments": {
"location": "New York City, NY",
"unit": "fahrenheit"
}
}
</tool_call>Manage zoo animals example
Payload
Response
<tool_call>
{
"name": "manage_zoo_animals",
"arguments": {
"action": "create",
"animal": {
"name": "Johnson",
"species": "kangaroo",
"age": 2
}
}
}
</tool_call>Structured tool calls
By default, a tool call is streamed back as raw text in whatever format the model emits (as in the examples above). To get a single, consistent parsed result regardless of the model, set parse_tool_calls to true in your request (alongside tools).
With it enabled, Paddler parses the model's output and returns a ToolCallParsed result:
Each parsed call has an id, the function name, and arguments. arguments is tagged - ValidJson holds the parsed object when the model produced valid JSON, and InvalidJson holds the raw string when it did not.
Troubleshooting
If parsing or validation does not succeed, you get one of these instead of ToolCallParsed:
ToolCallParseFailed: the tool-call text could not be parsed.ToolCallValidationFailed: it parsed, but did not match the tool's parameter schema.UnrecognizedToolCallFormat: the output did not match a recognized tool-call format (includes the raw text).ToolSchemaInvalid: theparametersschema you supplied intoolsis not a valid JSON Schema.