Skip to content

Commit

Permalink
Merge pull request #10 from chenyushuo/new_env
Browse files Browse the repository at this point in the history
Quick fix on chatroom
  • Loading branch information
pan-x-c authored Oct 23, 2024
2 parents fc98f32 + 84c44de commit b11fa41
Show file tree
Hide file tree
Showing 5 changed files with 188 additions and 96 deletions.
42 changes: 9 additions & 33 deletions examples/environments/chatroom/chatroom_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,57 +59,33 @@ def main(args: argparse.Namespace) -> None:
),
role="system",
)
r = ChatRoom(name="chat", announcement=ann, to_dist=args.use_dist)
r = ChatRoom(
name="chat",
announcement=ann,
model_config_name=YOUR_MODEL_CONFIGURATION_NAME,
to_dist=args.use_dist,
)

# Setup the persona of Alice, Bob and Carol
alice = ChatRoomAgent( # Game Art Designer
name="Alice",
sys_prompt=r"""You are a game art designer named Alice. """
r"""Programmer Bob and game planner Carol are your colleagues, """
r"""and you need to collaborate with them to complete an open """
r"""world game. Please ask appropriate question to planner or """
r"""generate appropriate responses in this work group based on """
r"""the following chat history. When you need to mention someone, """
r"""you can use @ to remind them. You only need to output Alice's """
r"""possible replies, without giving anyone else's replies or """
r"""continuing the conversation. When the discussion is complete, """
r"""you need to reply with a message containing 'Goodbye' to """
r"""indicate exiting the conversation.""",
sys_prompt=r"""You are a game art designer named Alice.""",
model_config_name=YOUR_MODEL_CONFIGURATION_NAME,
to_dist=args.use_dist,
)
alice.join(r)

bob = ChatRoomAgent( # Game Programmer
name="Bob",
sys_prompt=r"""You are a game programmer named Bob. """
r"""Art designer Alice and game planner Carol are your colleagues, """
r"""and you need to collaborate with them to complete an open """
r"""world game. Please ask appropriate questions or generate """
r"""appropriate responses in the work group based on the following """
r"""historical records. When you need to mention someone, you can """
r"""use @ to remind them. You only need to output Bob's possible """
r"""replies, without giving anyone else's replies or continuing """
r"""the conversation. When the discussion is complete, you need """
r"""to reply with a message containing 'Goodbye' to indicate """
r"""exiting the conversation.""",
sys_prompt=r"""You are a game programmer named Bob.""",
model_config_name=YOUR_MODEL_CONFIGURATION_NAME,
to_dist=args.use_dist,
)
bob.join(r)

carol = ChatRoomAgent( # Game Designer
name="Carol",
sys_prompt=r"""You are a game planner named Carol. """
r"""Programmer Bob and art designer Alice are your colleagues, """
r"""and you need to guide them in developing an open world game. """
r"""Please generate a suitable response in this work group based """
r"""on the following chat history. When you need to mention """
r"""someone, you can use @ to remind them. You only need to output """
r"""Carol's possible replies, without giving anyone else's replies """
r"""or continuing the conversation. When the discussion is """
r"""complete, you need to reply with a message containing """
r"""'Goodbye' to indicate exiting the conversation.""",
sys_prompt=r"""You are a game planner named Carol.""",
model_config_name=YOUR_MODEL_CONFIGURATION_NAME,
to_dist=args.use_dist,
)
Expand Down
19 changes: 9 additions & 10 deletions examples/environments/chatroom/chatroom_with_assistant_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ def main(args: argparse.Namespace) -> None:

bob = ChatRoomAgentWithAssistant(
name="Bob",
sys_prompt=r"""You are Bob's chat room assistant and he is """
sys_prompt=r"""You are Bob's chat room assistant and Bob is """
r"""currently unable to reply to messages. Please generate a """
r"""suitable response based on the following chat history. """
r"""The content you reply to must be based on the chat history. """
r"""Please refuse to reply to questions that are beyond the scope """
r"""of the chat history.""",
r"""suitable response based on the following chat history without """
r"""reasoning. The content you reply to must be based on the chat """
r"""history. Please refuse to reply to questions that are beyond """
r"""the scope of the chat history.""",
model_config_name=YOUR_MODEL_CONFIGURATION_NAME,
to_dist=args.use_dist,
timeout=args.timeout,
Expand Down Expand Up @@ -176,11 +176,10 @@ def main(args: argparse.Namespace) -> None:
# Setup the persona of Carol
carol = ChatRoomAgent(
name="Carol",
sys_prompt=r"""You are Carol, and now you need to interview Bob. """
r"""Just ask him where he is from, which school he graduated from, """
r"""his profession, and his hobbies. At the end of the interview, """
r"""please output a reply containing Goodbye to indicate the end """
r"""of the conversation.""",
sys_prompt="""You are Carol, and now you need to interview Bob. """
"""Just ask him where he is from, which school he graduated from, """
"""his profession, and his hobbies. You'd better only ask one """
"""question at a time.""",
model_config_name=YOUR_MODEL_CONFIGURATION_NAME,
to_dist=args.use_dist,
)
Expand Down
Loading

0 comments on commit b11fa41

Please sign in to comment.