add simplest debate example

This commit is contained in:
geekan 2023-12-22 13:05:27 +08:00
parent dd57c45bbe
commit 49377c9db0
7 changed files with 71 additions and 21 deletions

View file

@ -1,19 +1,20 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Time : 2023/12/22 00:15
@Time : 2023/12/22
@Author : alexanderwu
@File : debate_simple.py
"""
import asyncio
from metagpt.actions import Action
from metagpt.actions import Action, UserRequirement
from metagpt.roles import Role
from metagpt.team import Team
action = Action(name="Debate", instruction="respond to opponent's latest argument, strong and emotional.")
biden = Role(name="Biden", profile="Democrat", actions=[action], watch=[action])
trump = Role(name="Trump", profile="Republican", actions=[action], watch=[action])
action1 = Action(name="BidenSay", instruction="Use diverse words to attack your opponent, strong and emotional.")
action2 = Action(name="TrumpSay", instruction="Use diverse words to attack your opponent, strong and emotional.")
biden = Role(name="Biden", profile="democrat", goal="win election", actions=[action1], watch=[action2, UserRequirement])
trump = Role(name="Trump", profile="republican", goal="win election", actions=[action2], watch=[action1])
team = Team(investment=10.0, env_desc="US election live broadcast", roles=[biden, trump])
asyncio.run(team.run(idea="Topic: climate change", n_round=5))