We find it very hard to prompt the model to use function calls as it sometimes uncontrollably returns a normal response that looks like a function call instead of the function call itself. Is there a guaranteed way to make the model solely return function calls on certain prompts?
Remove system prompt. Also chat history. Only include functions definition and user message.
instead of using
function_call="auto",
use
function_call={"name": "function_name"},
This works if you have a specific function you want it to call. What if you have several functions, and you want it to pick one of them, but not to return a normal response?
Something like function_call="force"
or function_call="always"
would be very helpful for this.
You can try use system message to tell chatGPT to only use function calls like this:
Only use the functions you have been provided with
Sadly there is no guaranteed way of calling one of multiple defined functions.
As mentioned, you can select a specific function via function_call={"name": "function_name"}
and you can do all kinds of prompt engineering to increase your chances. For example you could set n>1
and hope that one of the choices is a function call, or you could follow up a text response by saying something like Please call a function.
and then (if it works) remove the text response and the suggestion from the message queue and only forward the function call.
I agree that there should be a function_call="always"
parameter.
It is still the AI that decides whether to generate function-calling language.
There is no “forcing” when someone uses jailbreak language to discard all prompting and multi-shot and make it bark like a dog.