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: enabled saving and evaluation for moderator (#271) #272

Draft
wants to merge 3 commits into
base: demo
Choose a base branch
from

Conversation

XuhuiZhou
Copy link
Member

  • feat: enable saving AgentProfile and chat history on redis

  • fix: AgentProfile can now be loaded by EpisodeLog correctly

  • feat: enable evaluation of EpisodeLog

  • [autofix.ci] apply automated fixes

  • fix: use EpisodeLog and AgentProfile from sotopia directly


Closes #

📑 Description

✅ 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

* feat: enable saving AgentProfile and chat history on redis

* fix: AgentProfile can now be loaded by EpisodeLog correctly

* feat: enable evaluation of EpisodeLog

* [autofix.ci] apply automated fixes

* fix: use EpisodeLog and AgentProfile from sotopia directly

---------

Co-authored-by: JXZhou <JXZhou>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
@XuhuiZhou XuhuiZhou marked this pull request as draft January 7, 2025 19:46
if len(self.message_history) == 1:
self.message_history[0].append(
self.message_history.append(
[
(
agent_action.agent_name,
"Environment",
Copy link
Member Author

Choose a reason for hiding this comment

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

@JXZhou0224 let's think this a bit more carefully, a messge should be (sender, receivers (seperated by comma), message content), so maybe we should not put environment here anymore

Copy link
Collaborator

Choose a reason for hiding this comment

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

Certiainly! I will fix it. I set the receiver to "Enivronment" because in the render_for_human() method in EpisodeLog requires the message to be sent to "Environment" in order to render successfully. I think I will change it to "All" to represent sending to everyone and rewrite the render_for_human() method.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah I see, maybe that's fine if environment defaults to all.

last_turn=self.scenario,
last_turn=json.dumps(
{
"use_pk_value": self.use_pk_value,
Copy link
Member Author

Choose a reason for hiding this comment

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

What is this for?

Copy link
Collaborator

Choose a reason for hiding this comment

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

The hyperparameter that determines "whether to use AgentProfile from exisiting database" is set in the moderator. Therefore, moderator will communicate this information to all Agents before the start of conversation.

epilog.save()
# print(epilog.render_for_humans())
if self.push_to_db:
epilog.save()
return epilog
Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe we need to change this to evaluation queue or something

self.model_name: str = model_name
self.agent_profile_pk: str = agent_pk
self.name: str = agent_name
self.background: dict = background
Copy link
Member Author

@XuhuiZhou XuhuiZhou Jan 8, 2025

Choose a reason for hiding this comment

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

Note self.background is not used anywhere when generating the agent actions

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