How to increase the likelihood of GPT making function calls?

I have a lot of call functions. I hope the model will call functions to answer as much as possible.

I don’t know how the model chooses function.

Anyone can offer some solutions for me?

Tks

1 Like

When the tool_choice is set to auto, the model chooses which tool to call based on the user message.

The better the json schema doc for the function(s) the more aligned the model’s tool_calls are going to be, i.e the more likely the model is to call the particular tool when it should be called.

If you want to force the model to call a particular tool, you can set the tool_choice to that particular function via {"type": "function", "function": {"name": "my_function"}}

Additionally, you can also add to the system message if you want to call a tool at every step in the conversation to always make tool call since the functions are injected into the system message under the hood.

1 Like