PRODUCTION SCENARIO
A workflow defines three tools: lookup_customer, cancel_order, and file_dispute. In one phase, business logic requires the model to call cancel_order rather than any other tool or plain text.
Which request configuration enforces that?
Answering here is anonymous. Nothing is saved unless you sign in.
Show answer and explanation
Answer: tool_choice set to { type: "tool" } with name set to cancel_order
Naming the tool in tool_choice forces a call to that exact tool. type any forces a call but lets the model pick among all three. auto with a prompt instruction raises the likelihood of a call without requiring one, which is the documented workaround on models that reject forced tool use rather than an enforcement mechanism. Narrowing the tools array removes the alternatives but still permits a plain text reply, and it changes what the model can do for the rest of the request.