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

@ -38,6 +38,13 @@ class Team(BaseModel):
investment: float = Field(default=10.0)
idea: str = Field(default="")
def __init__(self, **kwargs):
super().__init__(**kwargs)
if "roles" in kwargs:
self.hire(kwargs["roles"])
if "env_desc" in kwargs:
self.env.desc = kwargs["env_desc"]
class Config:
arbitrary_types_allowed = True
@ -113,8 +120,11 @@ class Team(BaseModel):
logger.info(self.json(ensure_ascii=False))
@serialize_decorator
async def run(self, n_round=3):
async def run(self, n_round=3, idea=""):
"""Run company until target round or no money"""
if idea:
self.run_project(idea=idea)
while n_round > 0:
# self._save()
n_round -= 1