Former-commit-id: 882b6f8366
group-chat
Kye 2 years ago
parent 0b9dc644b6
commit 2c0b2a4bc3

@ -4,6 +4,15 @@ worker1 = Worker(ai_name="Plinus", openai_api_key="")
worker2 = Worker(ai_name="Optimus Prime", openai_api_key="")
collab = DialogueSimulator([worker1, worker2], DialogueSimulator.select_next_speaker)
collab.reset()
collab.step()
collab.start("My name is Plinus and I am a worker", "How are you?")
# collab.start("My name is Plinus and I am a worker", "How are you?")
max_iters = 6
n = 0
while n < max_iters:
collab.start("My name is Plinus and I am a worker", "How are you?")
print(f"({name}): {message}")
print("\n")
n += 1

@ -6,15 +6,15 @@ class DialogueSimulator:
def __init__(
self,
agents: List[Worker],
selection_func
selection_func: Callable[[int, List[Worker]], int],
):
self.agents = agents
self._step = 0
self.select_next_speaker = selection_func
def reset(self):
for agent in self.agents:
agent.reset()
# def reset(self):
# for agent in self.agents:
# agent.reset()
def start(self, name: str, message: str):
#init conv with a message from name

Loading…
Cancel
Save