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

Added an 'auto' mode to last_n_messages #693

Merged
merged 3 commits into from
Nov 15, 2023
Merged

Added an 'auto' mode to last_n_messages #693

merged 3 commits into from
Nov 15, 2023

Conversation

afourney
Copy link
Member

Why are these changes needed?

At present, code execution will scan back n messages to find code to run. Here, n is fixed at the time the agent is created (and it defaults to 1). This code make this scanning dynamic, by searching through all the "new" messages that arrived since the agent last spoke (which is also typically when it last tried to execute code).

Related issue number

This, together with #688, and #669, will likely address many issues related to user_proxy spam (issue: #624)

Checks

@codecov-commenter
Copy link

codecov-commenter commented Nov 15, 2023

Codecov Report

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

Comparison is base (72f488e) 28.70% compared to head (e17cf27) 37.19%.

Files Patch % Lines
autogen/agentchat/conversable_agent.py 81.81% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #693      +/-   ##
==========================================
+ Coverage   28.70%   37.19%   +8.49%     
==========================================
  Files          27       27              
  Lines        3383     3393      +10     
  Branches      760      764       +4     
==========================================
+ Hits          971     1262     +291     
+ Misses       2341     2014     -327     
- Partials       71      117      +46     
Flag Coverage Δ
unittests 37.13% <81.81%> (+8.49%) ⬆️

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.

@afourney afourney marked this pull request as ready for review November 15, 2023 20:55
Copy link
Contributor

@pcdeadeasy pcdeadeasy left a comment

Choose a reason for hiding this comment

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

Looks good. Small nit pick: will be good to say last n used messages

Copy link
Contributor

@sonichi sonichi left a comment

Choose a reason for hiding this comment

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

Nice PR. Could you add a test to cover the new code? In test_groupchat.py.

@afourney
Copy link
Member Author

Nice PR. Could you add a test to cover the new code? In test_groupchat.py.

Done :)

@sonichi sonichi added this pull request to the merge queue Nov 15, 2023
Merged via the queue into main with commit 5dfc73d Nov 15, 2023
52 of 58 checks passed
@sonichi sonichi deleted the last_n_messages_auto branch November 15, 2023 22:59
whiskyboy pushed a commit to whiskyboy/autogen that referenced this pull request Apr 17, 2024
* Added an 'auto' mode to last_n_messages

* Added tests for the last_n_messages = 'auto' mode

* Added test one additional test case that was overlooked.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-execution execute generated code group chat/teams group-chat-related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants