In function calling, the tool_choice setting controls whether the model must call a specific function, may call any function, or must answer without calling. Forcing a call on a question that needs no data wastes a round trip and can produce a call with invented arguments; leaving it automatic on a question that needs live data can produce an answer from memory. The right setting depends on the question type.
Before you start
An API client that supports the tool_choice setting, and a set of questions that mix data lookups with general questions.
Sort the questions by need
Split your questions into three groups: must-call (the answer only exists in the database), may-call (the answer could use data but does not need it), and must-not-call (greetings, policy questions, general knowledge).
Label each question before you run it. A label written after seeing the result is not a test.
Test forced and automatic on each group
Run the must-call group with tool_choice set to the function and again with automatic, and count correct answers in each. Then run the may-call and must-not-call groups the same way.
Record two failure types separately: a call with invented arguments, and an answer given without the data it needed.
Set the rule per question type
Force the call only for the must-call group, where the data is required. Leave the may-call group on automatic so the model can decide, and set must-not-call to none so no function runs.
Write the rule into your routing code, not into the prompt: the setting is enforced by the API, the prompt is only a suggestion.
Practice check: fictional Maple Corner questions, 15 total, 5 per group
The table below is fictional practice material, worked out by hand from the stated settings. It is the expected result for the practice questions, not a run of any API.
| Group | Forced correct | Automatic correct | Rule |
|---|---|---|---|
| Must-call data | 5 of 5 | 3 of 5 | Force the call |
| May-call | 4 of 5 | 5 of 5 | Leave automatic |
| Must-not-call | 2 of 5 | 5 of 5 | Set to none |
Forcing helps only the must-call group. On the other two groups it hurts: invented arguments on may-call questions and wasted calls on greetings. The rule is per group, not one setting for all.
Expected result. UNTESTED: the scores in the practice table are worked out by hand, not measured by running an API. Sort your own questions into must-call, may-call and must-not-call, run both settings on each group, and set the rule per group.
Limits
- tool_choice is an API setting, not a prompt instruction: the model cannot override it by deciding otherwise.
- A forced call still needs argument validation: forcing the call does not make the arguments correct.
