Description
I'm not sure if this is already possible but couldn't find it supported so asking for it here.
We want to have the ability to force the model to call a tool out of the list of tools we send it, this is leveraged with the FunctionChoiceBehavior.Required(), but we also want to be able to stop forcing it during the run, and the execution settings would be updated with FunctionChoiceBehavior.Auto() preferably through filters
.
e.g - I have 3 tools: get_data(user_id: str)
, update_data(user_id: str, payload: Any)
, generate_answer_to_user()
, no_tool_found()
.
And the question is: "I need to update data based on existing data with this user ID etc etc..."
By leveraging the system prompt and functions descriptions properly together with filters and auto function invocation, we can see in the filters if the model wants to call the generate_answer_to_user()
and based on that we know the model is done answering so we can switch to None
or Auto
instead of Required
, but until then, we want to use the Required
flag.
In a scenario where no tool is available to answer the query it would pick no_tool_found
so we can differentiate between a happy and failed flow, in which case we just context.terminate = True
.
Looking at the code I'm seeing that the execution_settings
object is being deepcopy
'd and cannot be updated from the function calls nor the context object being sent to the filter, so it's not very possible without doing a lot of the implementation from scratch.
We want to keep leveraging AutoFunctionCalling and still have this feature.
Language: Python