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

feat: Add 3 new features to Moderator #266

Conversation

JXZhou0224
Copy link

@JXZhou0224 JXZhou0224 commented Dec 9, 2024

Closes #

📑 Description

Three new features are add to Moderator

  1. before the actual chat starts, moderator will send checking messages to all agents every 5 seconds, until all agents are fully ready to start chatting.
  2. added save() method to enable moderator to save the Episode in the format of EpisodeLog
  3. when chat is finished (currently, it is reaching the bound of max turns of chats), moderator will ask all agents to leave the chat

✅ Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed
  • Branch name follows type/descript (e.g. feature/add-llm-agents)
  • Ready for code review

ℹ Additional Information

@JXZhou0224
Copy link
Author

Also, for quick testing. I have added a DummyAgent in the demo file, so that the moderator can be tested without actually calling any LLM APIs.

Copy link
Member

@XuhuiZhou XuhuiZhou left a comment

Choose a reason for hiding this comment

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

Thanks for the effort! left some comments. One structural thing to note is that let's not use moderator inherit from the baseAgent.

Since the interface of baseAgent should be different. And we would want moderator have different event loop than the agent in the future.

This could be easy to do for now, just copy the baseagent code but make sure the send does not imply the action has to be the same

examples/experimental/sotopia_original_replica/dummy.toml Outdated Show resolved Hide resolved
sotopia/experimental/agents/moderator.py Show resolved Hide resolved
sotopia/experimental/agents/moderator.py Outdated Show resolved Hide resolved
observations_map={
output_channel: Observation(
agent_name="moderator",
last_turn=self.scenario,
Copy link
Member

Choose a reason for hiding this comment

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

Please double check the sotopia implementation of the last turn msg here:

The initial/boosting msg for every character should be different. This is a very important feature in Sotopia about info asymmetry

Copy link
Author

Choose a reason for hiding this comment

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

I have made a temprary fix for this. I also notice that the current ScriptBackGround dataType only supports 2 agents in chat. I think I will create a new background dataType for moderator.

Copy link
Member

Choose a reason for hiding this comment

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

thanks!

sotopia/experimental/agents/moderator.py Outdated Show resolved Hide resolved
sotopia/experimental/agents/moderator.py Outdated Show resolved Hide resolved
@XuhuiZhou
Copy link
Member

Also, for quick testing. I have added a DummyAgent in the demo file, so that the moderator can be tested without actually calling any LLM APIs.

For testing purpose, can we route to the pytest files?

@JXZhou0224
Copy link
Author

JXZhou0224 commented Dec 11, 2024

Thanks for the review! I have made a few changes:

  1. now the moderator no longer inherits from BaseAgent but from Node directly. Passing the mypy checks.
  2. it is now possible to set different background for different agents
  3. the changes to the examples has been directly merged into the original one.
  4. other minor fixes

For testing purpose, can we route to the pytest files?

I have merged changes into the example directly, I will route future tests to pytest files if needed

@JXZhou0224 JXZhou0224 requested a review from XuhuiZhou December 11, 2024 02:26
observations_map={
output_channel: Observation(
agent_name="moderator",
last_turn=self.scenario,
Copy link
Member

Choose a reason for hiding this comment

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

thanks!

@XuhuiZhou XuhuiZhou merged commit 81fd841 into sotopia-lab:feature/sotopia-aact-env Dec 13, 2024
1 check passed
XuhuiZhou added a commit that referenced this pull request Dec 14, 2024
* initial framework

* initial conv

* fix module error

* feat: Add 3 new features to Moderator (#266)

* feat:introduce booting procedure, saving, and ending chat to moderator

* fix: moderator will now ignore none AgentAction, Observations now don't have to include all channels in the mapping

* merge changes of example into the original one

* fix: 1. save() method now accepts push_to_db config 2. booting()'s waiting time is changed to 0.1 sec

* fix: rewrite booting() so that different agent will receive different background information

* fix: moderator now inherits from Node directly, instead of from BaseAgent

---------

Co-authored-by: JXZhou <JXZhou>

* add save condition for moderator

* push to db false

* to fully stop

* stopping all agents

* fix mypy

* fix mypy error

---------

Co-authored-by: JXZhou <156194797+JXZhou0224@users.noreply.github.com>
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.

2 participants