Hi everyone,
I have read in many places that the benefit of using function calling is that it always returns an structured output, whereas simple prompting can sometimes return more verbose output that sometimes can not be converted to json.
Other feature of function calling is that when the function isn’t called (because there are no arguments in the user query that satisfy the call of the function) it outputs the response that the common chat would give.
The thing here is that I don’t want this last feature. I just want to use the function calling, and in case that my query doesn’t have an output for my function, just return an empty json/key.
For example, imagine I have a function for extracting the names of the cities that appear in the user query and my query is “What is the time in Sidney?”. The function will return something like {"cities": ["Sidney"]}
. What I want is that for the query “What was the time yesterday” it just outputs {"cities": []}
, and not the completion.
I know I can solve this with a bit of wrapping, but I want this because the kind of query I am using for my application tends to give very long answers, and I see the completion like a waste of tokens when it can do it cheaper.
Thank you very much!!