How tool calling works
- Send a question and function definitions to
/v1/chat/completions. - The model returns
tool_callswith function names, argument strings, and call IDs. - Your application validates and executes each call.
- Send the assistant message and a
role: "tool"result for every call back to the model. - Repeat until the model returns its answer or your application reaches its budget.
tool_call_id, so independent functions can run concurrently.
The public API returns function requests. Your application provides the implementations, credentials, and execution. Naming a function
search does not enable a hosted search service.Choose the right output
Function parameter schemas describe the expected arguments; they do not constrain decoding. Validate names and arguments before execution, even if a function declares
strict: true. Tools cannot be combined with JSON-schema output or regex in the same request; the Perceptron SDK rejects this combination before sending it.
Build a tool workflow
Call a function
Run a complete Python example, handle streaming calls, and learn the supported controls.
Build a tool agent
Add execution budgets, return images, and combine retrieval with visual reasoning.
GET /v1/models?extended=true and check for tool_calling in the model’s capabilities array.