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

Controlling select_speaker using Graph Modelling Language #720

Merged
merged 12 commits into from
Nov 22, 2023

Conversation

joshkyh
Copy link
Collaborator

@joshkyh joshkyh commented Nov 19, 2023

I suggest @afourney and @thinkall review this work because of their recent contributions to incorporate modes of select_speaker in #688.

Why are these changes needed?

This notebook shows how we can use an expressive graph to control select_speaker. Instead of hard-coding complex logic to override select_speaker, this example shows how we can input a directed graph that dictates the transition paths between agents. If desired, we can also extend GroupChat select_speaker mode to "graph" in the near future (extending the work in #688) in another PR. I believe this is a necessary step towards having more agents working together, since the number of transition pairs increases rapidly (N Choose 2).

image

Related issue number

#485
#438 in terms of dividing the problem.

Checks

@joshkyh joshkyh changed the title Controllin select_speaker using Graph Modelling Language Controlling select_speaker using Graph Modelling Language Nov 19, 2023
@codecov-commenter
Copy link

codecov-commenter commented Nov 19, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 47.08%. Comparing base (f6498dc) to head (e3f0af0).
Report is 1604 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #720       +/-   ##
===========================================
+ Coverage   27.89%   47.08%   +19.18%     
===========================================
  Files          27       27               
  Lines        3466     3466               
  Branches      784      826       +42     
===========================================
+ Hits          967     1632      +665     
+ Misses       2428     1674      -754     
- Partials       71      160       +89     
Flag Coverage Δ
unittests 46.85% <ø> (+19.01%) ⬆️

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
Copy link
Member

Thanks. This looks really compelling. I need to dig into it more.

One thing I noticed is that it selects the next speaker randomly from among the candidate outgoing edges (or did I misread that?). I would love to see this instead use some variation of the current GroupChat prompt (or similar) to select the next speaker based on the conversations.

@joshkyh
Copy link
Collaborator Author

joshkyh commented Nov 20, 2023

Thanks. This looks really compelling. I need to dig into it more.

One thing I noticed is that it selects the next speaker randomly from among the candidate outgoing edges (or did I misread that?). I would love to see this instead use some variation of the current GroupChat prompt (or similar) to select the next speaker based on the conversations.

Hi @afourney,

Glad you find it useful. A partial yes, if suggested_next by the previous speaker is a legal transition, then that transition would happen. suggested_next is actually not random, it is suggested by the previous speaker.

However, if it is not a legal transition, we would pick a random agent from the legal transitions eligible_speakers as a catch-all. Yes, we can potentially insert the use of an LLM to pick an agent from the eligible_speakers before the catch-all.

Please feel free to review when you get some time. I'll act on the feedback tomorrow. Thanks for the review! :)

image

@BeibinLi
Copy link
Collaborator

Fantastic idea! I have thought about something similar earlier, but your implementation is much cleaner. I will take a deeper look later.

Copy link
Collaborator

@thinkall thinkall left a comment

Choose a reason for hiding this comment

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

Thanks @joshkyh , I love it. Allowing selecting speaker based on the complex network would push the group chat to a higher level, enabling a more meaningful large group chat.

Do you only want to show it as a notebook example? I believe it worth to add into the code.

@joshkyh
Copy link
Collaborator Author

joshkyh commented Nov 21, 2023

Would you like to add a link to this notebook in the website? There are two pages to update.

Thanks for the review, @sonichi. I have acted on the four feedback points and added the link to this notebook in two pages.

@joshkyh joshkyh requested a review from sonichi November 21, 2023 23:05
@sonichi sonichi added this pull request to the merge queue Nov 22, 2023
Merged via the queue into microsoft:main with commit 9d2ee46 Nov 22, 2023
55 of 70 checks passed
@joshkyh joshkyh deleted the notebook/graph_select_speaker branch November 22, 2023 22:09
@Friedensfreak
Copy link

Hi @joshkyh what is secret for each agent in the graph modelling. And how is this useful?

@joshkyh
Copy link
Collaborator Author

joshkyh commented Dec 6, 2023

Hey @Friedensfreak, thanks for the question.

In the notebook, the task was to find the total number of chocolates every agent have, which is denoted by secret. The example illustrates every agent contributing towards the problem but inter-team transitions only happen via the team leaders. Outside of this example, there is no need to use the secret attribute.

@Morriz
Copy link

Morriz commented Jan 5, 2024

will this be codified? Sharing code override examples is not the way forward imo.

@sonichi
Copy link
Contributor

sonichi commented Jan 5, 2024

See #743 and related PRs.

whiskyboy pushed a commit to whiskyboy/autogen that referenced this pull request Apr 17, 2024
)

* Completed notebook on using GML

* Added optional dependencies for graph

* Run pre-commit

* Added pytest

* Added LLM to pick an agent before catch-all

* Updated website links to notebook

* Reviewer's suggestions

* pre-commit checked

* pre-commit passed

* Change beta version
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.

8 participants