Session 5· 10· 10 min

Format vs Tools — when to use which

What you'll learn
  • ▸Distinguish response_format (data extraction) from tools (actions)
  • ▸See a decision flowchart for choosing the right approach
  • ▸Know when you need both

Both structured output and tool calling constrain what the model returns. They look similar but they solve different problems. Getting this distinction right is a Phase 1 → Phase 2 bridge.

response_format
for DATA
  • •Use when: your code READS the output
  • •Returns: a schema-shaped object
  • •Nothing gets "called"
  • •Examples: data extraction, classification, form filling
tools
for ACTIONS
  • •Use when: your code EXECUTES the output
  • •Returns: a request to run a function
  • •Your code runs the function and replies
  • •Examples: weather lookup, DB query, API call
Rule of thumb
If your code READS the result → structured output. If your code EXECUTES the result → tools. If both → use both; the API supports mixing response_format with tools.
$ python 10_format_vs_tooling_decision.py
Knowledge Check
You want the model to extract an address from a block of text. Which do you use?
Knowledge Check
You want the chatbot to look up a flight price from an API. Which do you use?
Recap — what you just learned
  • ✓response_format = model returns data in a shape
  • ✓tools = model returns a request for YOUR code to execute
  • ✓Use both together when you need extracted data AND actions
  • ✓Phase 2 (next 6 lessons) is all about tools
Next up: 11 — First Tool Definition