/ examples / debate_simple.py
debate_simple.py
 1  #!/usr/bin/env python
 2  # -*- coding: utf-8 -*-
 3  """
 4  @Time    : 2023/12/22
 5  @Author  : alexanderwu
 6  @File    : debate_simple.py
 7  """
 8  import asyncio
 9  
10  from metagpt.actions import Action
11  from metagpt.config2 import Config
12  from metagpt.environment import Environment
13  from metagpt.roles import Role
14  from metagpt.team import Team
15  
16  gpt35 = Config.default()
17  gpt35.llm.model = "gpt-3.5-turbo"
18  gpt4 = Config.default()
19  gpt4.llm.model = "gpt-4-turbo"
20  action1 = Action(config=gpt4, name="AlexSay", instruction="Express your opinion with emotion and don't repeat it")
21  action2 = Action(config=gpt35, name="BobSay", instruction="Express your opinion with emotion and don't repeat it")
22  alex = Role(name="Alex", profile="Democratic candidate", goal="Win the election", actions=[action1], watch=[action2])
23  bob = Role(name="Bob", profile="Republican candidate", goal="Win the election", actions=[action2], watch=[action1])
24  env = Environment(desc="US election live broadcast")
25  team = Team(investment=10.0, env=env, roles=[alex, bob])
26  
27  asyncio.run(team.run(idea="Topic: climate change. Under 80 words per message.", send_to="Alex", n_round=5))