Skip to content

Commit

Permalink
fix distributed debate
Browse files Browse the repository at this point in the history
  • Loading branch information
pan-x-c committed Jan 6, 2025
1 parent 4f897f9 commit 4d5fda1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions examples/distributed_debate/distributed_debate.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# -*- coding: utf-8 -*-
""" An example of distributed debate """

import argparse

from user_proxy_agent import UserProxyAgent

from loguru import logger

import agentscope
from agentscope.agents import DialogAgent
Expand Down Expand Up @@ -87,13 +85,19 @@ def setup_server(parsed_args: argparse.Namespace) -> None:
server_launcher.wait_until_terminate()


def print_msg(msg: Msg) -> None:
"""Print message"""
print(msg.formatted_str(colored=True))


def run_main_process(parsed_args: argparse.Namespace) -> None:
"""Setup the main debate competition process"""
pro_agent, con_agent, judge_agent = agentscope.init(
model_configs="configs/model_configs.json",
agent_configs="configs/debate_agent_configs.json",
project="Distributed Conversation",
)
judge_agent = judge_agent.to_dist()
pro_agent = pro_agent.to_dist(
host=parsed_args.pro_host,
port=parsed_args.pro_port,
Expand All @@ -113,9 +117,9 @@ def run_main_process(parsed_args: argparse.Namespace) -> None:
for i in range(3):
hub.broadcast(announcements[i])
pro_resp = pro_agent()
logger.chat(pro_resp)
print_msg(pro_resp)
con_resp = con_agent()
logger.chat(con_resp)
print_msg(con_resp)
judge_agent()
hub.broadcast(end)
judge_agent()
Expand Down

0 comments on commit 4d5fda1

Please sign in to comment.