-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Fix some type annotations and edge cases #572
Conversation
@microsoft-github-policy-service agree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to be more conservative 😸 I provide some examples of changes that can be undone.
Codecov Report
@@ Coverage Diff @@
## main #572 +/- ##
==========================================
+ Coverage 34.04% 39.50% +5.46%
==========================================
Files 25 25
Lines 3005 3007 +2
Branches 668 668
==========================================
+ Hits 1023 1188 +165
+ Misses 1906 1722 -184
- Partials 76 97 +21
Flags with carried forward coverage won't be shown. Click here to find out more.
|
f5eaadc
to
05cd2ff
Compare
Rebased to last commit and removed controversial breaking change. |
05cd2ff
to
4c24437
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. We need to fix "GroupChat" after this PR.
* Fix some type annotations in agents This fixes some errors in type annotations of `ConversableAgent`, `UserProxyAgent`, `GroupChat` and `AssistantAgent` by adjusting the type signature according to the actual implementation. There should be no change in code behavior. * Fix agent types in `GroupChat` Some `Agent`s are actually required to be `ConversableAgent` because they are used as one. * Convert str message to dict before printing message * Revert back to Agent for GroupChat * GroupChat revert update --------- Co-authored-by: Beibin Li <[email protected]> Co-authored-by: Beibin Li <[email protected]>
Why are these changes needed?
This PR is a rather conservative attempt to partially fix #513, i.e. to provide a set of more correct type annotations for the library and fix unhandled edge cases found by type checker along the way.
It adjusts some wrong type signatures to fit the actual code implementation.
Related issue number
#513
Remaining problems
ConversableAgent.register_reply
,reply_func
is documented as follows:In reality some of the
reply_func
s supportNone
assender
and some don't. I don't know if the documentation or the implementation should be changed so I left it as-is.ConversableAgent.(a)_send
andreceive
actually requires the corresponding target to also beConversableAgent
s because the extrasilent
parameter. There's no way to fix this without breaking changes for many. Sincesilent
is declared experimental I decided to leave it there.Some other rough edges either caused by type checkers or subtle interactions between many functions. They don't cause noticeable bugs as of now, and I'm not going to "fix" them by refactoring the whole codebase.
AFAIK
oai
module and its related code is under a major refactoring. This PR won't touch these unstable code.Checks
No new tests are required and documentation has been changed accordingly.