New Tool Radar

AI Concepts

How to Choose Function Calling When the Model Must Act, and JSON Mode When It Must Only Format

Use function calling when the model needs data or actions from your system, and JSON mode only when the reply itself must be JSON.

Schematic with three steps: Ask whether the model must act; Check what each option guarantees; Pick the option and set the choice.

Function calling, also called tool calling, connects the model to data and actions provided by your application: the model returns a structured call, your code runs it, and you send the result back. JSON mode only guarantees the reply is valid JSON; it does not guarantee the JSON follows your schema and it does not call anything. The rule is simple: if the model must act, use function calling; if it must only format its reply for your UI, use a structured response format. Structured outputs are the evolution of JSON mode, and only structured outputs ensure schema adherence.

What you need

  • The task the model must do: an action or a formatted reply
  • The functions your application can run, if any
  • The schema the reply must follow, if any

Step 1: Ask whether the model must act

If the answer needs live data, a database lookup, or an action such as sending an email, the model must call a function, and JSON mode cannot do that. If the answer is only text for display, formatting is enough.

Step 2: Check what each option guarantees

Function calling returns a tool call with arguments that your code executes, and the model then writes a final response from the result. JSON mode returns valid JSON but does not adhere to a schema, so your code must still validate it.

Step 3: Pick the option and set the choice

Use function calling with the tools defined and tool_choice set to auto when the model should decide, or to a named tool when it must call one. Use a structured response format with a JSON Schema when only the format matters.

Worked example: three synthetic tasks matched to a mechanism

The table below is a synthetic example. It shows the expected result of matching tasks to mechanisms; no call was made.

Task Must act? Mechanism
Check a live order status Yes – needs the database Function calling
Return a math answer as JSON No – format only Structured output
Summarise a ticket as JSON No – format only JSON mode or structured output
Book a meeting room Yes – needs the calendar Function calling

Expected result (UNTESTED). the two tasks that need an action use function calling, and the two format-only tasks use a structured format. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • Structured outputs are recommended over JSON mode whenever possible, because only structured outputs ensure schema adherence.
  • Function definitions count against the model context limit and are billed as input tokens.
  • Tool choice none means the model will not call any tool; auto means it can pick; required means it must call one or more.
  • If your application has many functions, keep the number available at the start of a turn below 20 for higher accuracy.

Sources

See all