Hi everyone, I am trying to use gpt-3.5-turbo-16k to answer a question based on a provided context, and if the answer is not found, call a function to get new context.
However, even when the answer is available in the context, the model returns first a function call. When I set the function_call parameter to “none”, then the model returns the correct answer. But when the function_call parameter is set to “auto” (the default value) then it calls a function.
Anyone encountered this and has suggestions on how to guide the model to only call the function if it cannot find an answer in the context?
Welcome to the forum, Nathan.
I’ve not seen this problem before, but to aid those that might of, can you please post the code you are using to make the API call, any setup code that it relies upon and examples of prompts and responses that are not up to your expectations, thanks.
1 Like
Can you give an example of a call where you are receiving these unexpected results?
Im seeing this issue as well .
There is a rather radical “solution” to your problem: do not let GPT decide when to make function call, let user make a decision instead. So if user wanted to get context for some questions, they should start their request like “BUILD CONTEXT: I want such and such…”
And in the function description, I didn’t tell GPT what this function is for, so it won’t start a function call by itself; instead, I only tell GPT when user used the trigger word ("BUILD CONTEXT: "), collect arguments from user input (“I want such and such…”) then send it to the function.
The user experience won’t feel so “seamless” because they have to stop to ask for context themselves, but it stopped GPT to make its own call nilly-willy.
Hi, can you please provide the code used to make the API calls, the prompts and the responses, typically these issues come down to prompt engineering and the way the calls and functions are setup.
@_nathan You will need to adjust the description of the function and the related parameters to let the model understand the function better, it would be helpful if you post the schema of the function so we can replicate some quick tests.
As @kjordan mentioned, you need to work on the descriptions of your toolbox, but also add in a check to make sure the function name return actually matches the definitions that you have. I found that sometimes it would end up hallucinating a function name.