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

Support functions removing in ConversableAgent #1786

Merged
merged 7 commits into from
Feb 27, 2024

Conversation

skzhang1
Copy link
Collaborator

Why are these changes needed?

there are scenarios where we not only need to register functions but also remove previously registered ones in UserProxyAgent. Similar to the existing update_function_signature in the assistant, we also need an interface to remove functions in UserProxyAgent.

Related issue number

Checks

@codecov-commenter
Copy link

codecov-commenter commented Feb 26, 2024

Codecov Report

Attention: Patch coverage is 60.00000% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 48.02%. Comparing base (c6f6707) to head (f4b2c51).

Files Patch % Lines
autogen/agentchat/conversable_agent.py 60.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1786       +/-   ##
===========================================
+ Coverage   36.96%   48.02%   +11.05%     
===========================================
  Files          62       62               
  Lines        6525     6528        +3     
  Branches     1445     1571      +126     
===========================================
+ Hits         2412     3135      +723     
+ Misses       3920     3144      -776     
- Partials      193      249       +56     
Flag Coverage Δ
unittests 47.94% <60.00%> (+10.98%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@BeibinLi BeibinLi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new feature looks good to me.

However, the usage of using "None" for removal inside a "register" function might be a little bit confusing for some users. If we can change this function name to "update_function_registration", it would be more correct...

Let's forget about the function name for backward compatibility for now.

@julianakiseleva julianakiseleva added the function/tool suggestion and execution of function/tool call label Feb 26, 2024
@skzhang1
Copy link
Collaborator Author

@BeibinLi Agree. We may consider changing the function name in future PR.

Copy link
Collaborator

@LeoLjl LeoLjl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @BeibinLi. Setting parameters to None to remove functions seems not a straightforward way and can cause confusion. The code looks good to me.

@ekzhu
Copy link
Collaborator

ekzhu commented Feb 27, 2024

Perhaps we can create a new function update_function_map which updates the function map, with two arguments: to_add, which is a dictionary, and to_remove, which is a list of function names. Would that work? Meanwhile we put a deprecation notice to the register_function and re-implement that to use update_function_map.

Though I still would like to understand the usage case and why you need to have this feature.

@skzhang1
Copy link
Collaborator Author

@ekzhu I’m currently working on the AutoGen learning component. Having a convenient API to manipulate registered functions is crucial for me.
#1767 (review)

@skzhang1
Copy link
Collaborator Author

skzhang1 commented Feb 27, 2024

Perhaps we can create a new function update_function_map which updates the function map, with two arguments: to_add, which is a dictionary, and to_remove, which is a list of function names. Would that work? Meanwhile we put a deprecation notice to the register_function and re-implement that to use update_function_map.

Though I still would like to understand the usage case and why you need to have this feature.

Good suggestion. I will make it in the next PR. We can merge this one first.

@qingyun-wu qingyun-wu added this pull request to the merge queue Feb 27, 2024
Merged via the queue into microsoft:main with commit b872789 Feb 27, 2024
46 of 57 checks passed
whiskyboy pushed a commit to whiskyboy/autogen that referenced this pull request Apr 17, 2024
* fix

* update

* reformat

---------

Co-authored-by: “skzhang1” <“[email protected]”>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
function/tool suggestion and execution of function/tool call
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants