[GH-ISSUE #8155] Clarification: "format" vs "tools" behaviours #5207

Open
opened 2026-04-12 16:20:10 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @VMinB12 on GitHub (Dec 18, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/8155

Originally assigned to: @ParthSareen on GitHub.

What is the issue?

Structured output formatting was recently released. There are now 2 different ways of structuring your output:

  1. Pass a schema to the "format" argument to the API.
  2. Convert the schema to a tool and pass it to the "tools" argument to the API.

I understand that semantically, for structured output, it would make more sense to use the "format" option, whereas for tool use, the "tools" argument is more sensible.
My question is if there is any difference under the hood?

Specifically, I have the following questions:

  • Does tools insert the tool into the prompt using the tool tokens in the model chat template?
  • Does "format" insert the tool into the prompt using the tool tokens in the model chat template?
  • Does "format" ensure that the schema is respected, or only that the output is "json", but not necessarily "json" that complies to the schema? Is the behaviour exactly the same for "tools", or is there a difference?

OS

Linux

GPU

No response

CPU

No response

Ollama version

0.5.4

Originally created by @VMinB12 on GitHub (Dec 18, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/8155 Originally assigned to: @ParthSareen on GitHub. ### What is the issue? Structured output formatting was recently released. There are now 2 different ways of structuring your output: 1. Pass a schema to the "format" argument to the API. 2. Convert the schema to a tool and pass it to the "tools" argument to the API. I understand that semantically, for structured output, it would make more sense to use the "format" option, whereas for tool use, the "tools" argument is more sensible. My question is if there is any difference under the hood? Specifically, I have the following questions: - Does `tools` insert the tool into the prompt using the tool tokens in the model chat template? - Does "format" insert the tool into the prompt using the tool tokens in the model chat template? - Does "format" ensure that the schema is respected, or only that the output is "json", but not necessarily "json" that complies to the schema? Is the behaviour exactly the same for "tools", or is there a difference? ### OS Linux ### GPU _No response_ ### CPU _No response_ ### Ollama version 0.5.4
GiteaMirror added the bug label 2026-04-12 16:20:10 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#5207