pull/55/head
Kye 1 year ago
parent 56a04ed56e
commit 4c521437a0

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

@ -12,9 +12,9 @@ class DialogueSimulator:
self._step = 0 self._step = 0
self.select_next_speaker = selection_func self.select_next_speaker = selection_func
# def reset(self): def reset(self):
# for agent in self.agents: for agent in self.agents:
# agent.reset() agent.reset()
def start(self, name: str, message: str): def start(self, name: str, message: str):
#init conv with a message from name #init conv with a message from name

@ -115,7 +115,7 @@ class Worker:
self.message_history.append(f"{name}: {message}") self.message_history.append(f"{name}: {message}")
def send(self) -> str: def send(self) -> str:
self.agent.run(self.message_history) self.agent.run(task=self.message_history)
def add(self, task, priority=0): def add(self, task, priority=0):
self.task_queue.append((priority, task)) self.task_queue.append((priority, task))

Loading…
Cancel
Save