Skip to main content
Tool calling (also called function calling) lets a model decide to invoke functions you define, with arguments it generates. You run the function and feed the result back, so the model can use live data and take actions. Deepshi uses the OpenAI tool-calling format, so it works with the OpenAI SDKs and agent frameworks unchanged.

How it works

1

Define tools

Describe your functions with a JSON Schema for their parameters and pass them in tools.
2

Model requests a call

If the model decides a tool is needed, the response contains tool_calls with the function name and JSON arguments, and finish_reason is tool_calls.
3

You run the function

Execute the function in your own code with the supplied arguments.
4

Return the result

Append a tool message with the output and call the API again. The model uses it to produce a final answer.

Example

Controlling tool use

Use tool_choice to steer the model: Set parallel_tool_calls to false if you want at most one tool call per turn.

Next steps

Structured outputs

Force responses that match a JSON schema.

Reasoning

Use models that think before they answer.