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

More async tool fixes #1204

Merged
merged 2 commits into from
Jan 11, 2024
Merged

More async tool fixes #1204

merged 2 commits into from
Jan 11, 2024

Conversation

yenif
Copy link
Collaborator

@yenif yenif commented Jan 11, 2024

Why are these changes needed?

Fixes for #1174, also includes the bug fix in #1201

Started thinking about test coverage, a little awkward to exercise correctly.

Also there is odd interplay between sync/async tool funcs and if that conversations is calling through the sync or async send/receive methods.

Current setup

  • sync convo calls sync functions and tools
  • async convo calls async functions and tools, if no async function or tools then it calls sync functions and tools

Previously

  • sync convo calls sync functions
  • async convo calls sync and async function

I see a similar thing happen with check_termination_and_human_reply when running in async, it gets called twice if a_human_reply returns None for no human input.

I think https://github.com/miguelgrinberg/promisio can resolve the issue by providing the same interface for both sync and async functions. But that is a much bigger change and likely not backward compatible.

Related issue number

closes #1174

Checks

@codecov-commenter
Copy link

codecov-commenter commented Jan 11, 2024

Codecov Report

Attention: 27 lines in your changes are missing coverage. Please review.

Comparison is base (b548e55) 30.38% compared to head (0fe43fe) 50.03%.
Report is 2 commits behind head on main.

Files Patch % Lines
autogen/oai/client.py 77.14% 15 Missing and 9 partials ⚠️
autogen/agentchat/conversable_agent.py 40.00% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1204       +/-   ##
===========================================
+ Coverage   30.38%   50.03%   +19.65%     
===========================================
  Files          32       32               
  Lines        4302     4355       +53     
  Branches      994     1066       +72     
===========================================
+ Hits         1307     2179      +872     
+ Misses       2901     1963      -938     
- Partials       94      213      +119     
Flag Coverage Δ
unittests 49.94% <75.89%> (+19.60%) ⬆️

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.

@davorrunje
Copy link
Collaborator

Another option would be allowing both async and sync functions to be called using something like asyncer (https://github.com/tiangolo/asyncer). However, I would not add it as an additional dependency but rather rewrite it for our needs (that ~300 lines of code altogether and can be done in a day).

Copy link
Collaborator

@davorrunje davorrunje left a comment

Choose a reason for hiding this comment

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

LGTM.

I think we need to add tests for all of the new functionality, but that should be another PR because these fixes cannot wait.

@sonichi sonichi added this pull request to the merge queue Jan 11, 2024
Merged via the queue into microsoft:main with commit fba7cae Jan 11, 2024
79 of 84 checks passed
@sonichi sonichi deleted the more_async_func_fixes branch January 11, 2024 07:35
joshkyh pushed a commit that referenced this pull request Jan 17, 2024
* tool_responses fixes

* [] is false
whiskyboy pushed a commit to whiskyboy/autogen that referenced this pull request Apr 17, 2024
* add readme

* migration headsup

* remove move date

* Update README.md

Co-authored-by: Chi Wang <[email protected]>

---------

Co-authored-by: Chi Wang <[email protected]>
whiskyboy pushed a commit to whiskyboy/autogen that referenced this pull request Apr 17, 2024
* tool_responses fixes

* [] is false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Async_human_input openai.BadRequestError
4 participants