Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python: New Feature: Switch from FunctionChoiceBehavior.Required() to FunctionChoiceBehavior.Auto() from filters with Auto Function Invocation #10035

Open
barucoh opened this issue Dec 25, 2024 · 0 comments
Labels
python Pull requests for the Python Semantic Kernel triage

Comments

@barucoh
Copy link

barucoh commented Dec 25, 2024

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

@markwallace-microsoft markwallace-microsoft added python Pull requests for the Python Semantic Kernel triage labels Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Pull requests for the Python Semantic Kernel triage
Projects
None yet
Development

No branches or pull requests

2 participants