C.W.K.
Stream
Lesson 03 of 07 · published

How GPT Decides to Call Tools

~22 min · tool-decision, tool_choice

Level 0Tokenizer
0 XP0/54 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

The tool_choice parameter controls whether and how the model uses tools.

ValueBehavior
"auto" (default)Model decides whether to call zero, one, or multiple tools
"required"Model must call at least one tool
"none"Model cannot call any tools (text-only response)
{"type":"function","name":"get_weather"}Force a specific function call
{"type":"allowed_tools","mode":"auto","tools":[...]}Restrict to a subset of available tools

With "auto", the model examines the user's query and available tool descriptions to decide. Good tool descriptions are critical — they're the model's "manual" for knowing when and how to use each tool.

Code

tool_choice='auto' vs 'required' vs specific·python
# Force a specific function call
response = client.responses.create(
    model="gpt-5.4",
    input="What's the weather?",
    tools=tools,
    tool_choice={"type": "function", "name": "get_weather"},
)

# Require at least one tool call
response = client.responses.create(
    model="gpt-5.4",
    input="Look up current events.",
    tools=tools,
    tool_choice="required",
)

External links

Exercise

For one tool, run the same prompt three times: tool_choice='auto', 'required', and the specific name. Note which inputs make the model skip the tool under 'auto' and which force it under 'required'.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.