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

functionality of manual history cleaning by user proxy added #1230

Merged
merged 34 commits into from
Jan 27, 2024
Merged

functionality of manual history cleaning by user proxy added #1230

merged 34 commits into from
Jan 27, 2024

Conversation

Grigorij-Dudnik
Copy link
Collaborator

@Grigorij-Dudnik Grigorij-Dudnik commented Jan 13, 2024

What is this and how to use it?

Adds ability to clear agents' message history by user proxy manually writing "clear history" within message of user feedback.

Works for a groupchat when one of the agents is user proxy, recommended human_input_mode="ALWAYS".

When user asked to provide manual feedback, he can write "clear history" in his message to remove all the messages from agents history. Writing "clear history <agent_name>" will clear the history of messages only for selected agent. Writing "clear history <nr_of messages_to_preserve>" clears all the history except of last <nr_of messages_to_preserve> messages. Writing "clear history <agent_name> <nr_of messages_to_preserve>" will clear the history for selected agent except last <nr_of messages_to_preserve> messages.

User can noramally write other things in his message. "clear history" string and parameters will cutted out from user reply before passing it to the chat.

Why are these changes needed?

History of messages tends to grow endless very fast during group conversation. According to my experience, many of old messages became useless and just provide noise. Providing unnecesary history to LLM is bad practice because of:

  • Model attention distraction. Valuable information could be lost in the mess of noise. Model performance could significantly drop.
  • Processing unnecesary history causes huge costs. According to my experience, I'm spending 20-30$ on 3-4h session with Autogen using gpt-4-turbo.
  • Also causes long response times.
  • There is a risk of context window overflow, especially for models with small/medium context window lenghthes.

That's why having possibility to manage history during conversation is important.

Related issue number

It could be solution or partial solution for #156, but not only.

Checks

@codecov-commenter
Copy link

codecov-commenter commented Jan 13, 2024

Codecov Report

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

Comparison is base (1ab2354) 32.48% compared to head (fe813da) 45.25%.

Files Patch % Lines
autogen/agentchat/groupchat.py 92.10% 1 Missing and 2 partials ⚠️
autogen/agentchat/conversable_agent.py 77.77% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1230       +/-   ##
===========================================
+ Coverage   32.48%   45.25%   +12.76%     
===========================================
  Files          41       41               
  Lines        4907     4950       +43     
  Branches     1120     1201       +81     
===========================================
+ Hits         1594     2240      +646     
+ Misses       3187     2521      -666     
- Partials      126      189       +63     
Flag Coverage Δ
unittests 45.19% <89.36%> (+12.74%) ⬆️

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.

@Grigorij-Dudnik
Copy link
Collaborator Author

@microsoft-github-policy-service agree

@Grigorij-Dudnik
Copy link
Collaborator Author

@sonichi what do you think now? Everything is improved, I hope I answered all questions. Can we merge?

@sonichi
Copy link
Contributor

sonichi commented Jan 25, 2024

@sonichi what do you think now? Everything is improved, I hope I answered all questions. Can we merge?

Thanks. Running final tests.

@sonichi sonichi added this pull request to the merge queue Jan 26, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 26, 2024
@Grigorij-Dudnik
Copy link
Collaborator Author

Grigorij-Dudnik commented Jan 27, 2024

Seems like a problems with web browser. Have no idea why, changes are totally unrelated. I have no expertise in web browsing functionality, please help.

EDIT: I see it is a known bug with WebSurfer.

@afourney
Copy link
Member

Yeah there is a bug in of websurfer's tests. The fix is here, but can't be merged because of another bug in an unrelated notebook code formatting check:

#1417

@sonichi sonichi added this pull request to the merge queue Jan 27, 2024
Merged via the queue into microsoft:main with commit 0790da0 Jan 27, 2024
89 of 110 checks passed
corleroux pushed a commit to corleroux/autogen that referenced this pull request Jan 30, 2024
…ft#1230)

* functionality of manual history cleaning by admin added

* formatting improved

* formatting improved 2

* formatting improved 3

* test function added

* test code formatting

* test code formatting 2

* more advanced logging. Now user can see nr of messages to preserve as confirmation

* test_invalid_allow_repeat_speaker uncommented

* warning when providing recepient agent and nr messages to preserve added, changed variables names

* code formatting

* code formatting

* code formatting

* added 'enable_clear_history' variable to GroupChat

* 'enable_clear_history' added, better descripted

* clearing groupchat history added

* clearing groupchat history added

* two ifs merged into one, formatting improved

* two ifs merged into one, formatting improved

* two ifs merged into one, formatting improved

* formatting

* formatting

---------

Co-authored-by: Davor Runje <[email protected]>
Co-authored-by: Chi Wang <[email protected]>
whiskyboy pushed a commit to whiskyboy/autogen that referenced this pull request Apr 17, 2024
…ft#1230)

* functionality of manual history cleaning by admin added

* formatting improved

* formatting improved 2

* formatting improved 3

* test function added

* test code formatting

* test code formatting 2

* more advanced logging. Now user can see nr of messages to preserve as confirmation

* test_invalid_allow_repeat_speaker uncommented

* warning when providing recepient agent and nr messages to preserve added, changed variables names

* code formatting

* code formatting

* code formatting

* added 'enable_clear_history' variable to GroupChat

* 'enable_clear_history' added, better descripted

* clearing groupchat history added

* clearing groupchat history added

* two ifs merged into one, formatting improved

* two ifs merged into one, formatting improved

* two ifs merged into one, formatting improved

* formatting

* formatting

---------

Co-authored-by: Davor Runje <[email protected]>
Co-authored-by: Chi Wang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
group chat/teams group-chat-related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants