Skip to content

Commit

Permalink
update distributed examples
Browse files Browse the repository at this point in the history
  • Loading branch information
pan-x-c committed Jan 25, 2024
1 parent c768864 commit 7db302b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 24 deletions.
52 changes: 29 additions & 23 deletions examples/distributed/distributed_debate.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def parse_args() -> argparse.Namespace:
def setup_server(parsed_args: argparse.Namespace) -> None:
"""Setup rpc server for participant agent"""
agentscope.init(
model_configs="configs/model_configs.json",
model_configs="configs/model_configs_pxc.json",
)
with open(
"configs/debate_agent_configs.json",
Expand All @@ -82,29 +82,35 @@ def setup_server(parsed_args: argparse.Namespace) -> None:
def run_main_process(parsed_args: argparse.Namespace) -> None:
"""Setup the main debate competition process"""
agentscope.init(
model_configs="configs/model_configs.json",
)
pro_agent = DialogAgent(
name="Pro",
).to_dist(
host=parsed_args.pro_host,
port=parsed_args.pro_port,
launch_server=False,
)
con_agent = DialogAgent(
name="Con",
).to_dist(
host=parsed_args.con_host,
port=parsed_args.con_port,
launch_server=False,
)
judge_agent = DialogAgent(
name="Judge",
).to_dist(
host=parsed_args.judge_host,
port=parsed_args.judge_port,
launch_server=False,
model_configs="configs/model_configs_pxc.json",
)
with open(
"configs/debate_agent_configs.json",
"r",
encoding="utf-8",
) as f:
configs = json.load(f)
pro_agent = DialogAgent(
**configs["pro"],
).to_dist(
host=parsed_args.pro_host,
port=parsed_args.pro_port,
launch_server=False,
)
con_agent = DialogAgent(
**configs["con"],
).to_dist(
host=parsed_args.con_host,
port=parsed_args.con_port,
launch_server=False,
)
judge_agent = DialogAgent(
**configs["judge"],
).to_dist(
host=parsed_args.judge_host,
port=parsed_args.judge_port,
launch_server=False,
)
participants = [pro_agent, con_agent, judge_agent]
hint = Msg(name="System", content=ANNOUNCEMENT)
x = None
Expand Down
4 changes: 3 additions & 1 deletion examples/distributed/distributed_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ def setup_assistant_server(assistant_host: str, assistant_port: int) -> None:
"sys_prompt": "You are a helpful assistant.",
"model": "gpt-3.5-turbo",
"use_memory": True,
"local_mode": False,
},
host=assistant_host,
port=assistant_port,
Expand All @@ -60,6 +59,9 @@ def run_main_process(assistant_host: str, assistant_port: int) -> None:
)
assistant_agent = DialogAgent(
name="Assistant",
sys_prompt="You are a helpful assistant.",
model="gpt-3.5-turbo",
use_memory=True,
).to_dist(
host=assistant_host,
port=assistant_port,
Expand Down

0 comments on commit 7db302b

Please sign in to comment.