clean up of boss

Former-commit-id: ee93b2f61c
group-chat
Kye 1 year ago
parent e39f1fba97
commit 2706834962

@ -9,7 +9,7 @@ import chromadb
from chromadb.utils import embedding_functions
class Orchestrator(ABC):
class Orchestrator:
"""
The Orchestrator takes in an agent, worker, or boss as input
then handles all the logic for
@ -94,7 +94,7 @@ class Orchestrator(ABC):
self.executor = ThreadPoolExecutor(max_workers=len(agent_list))
@abstractmethod
# @abstractmethod
def assign_task(
self,
agent_id: int,
@ -143,7 +143,7 @@ class Orchestrator(ABC):
return embedding
@abstractmethod
# @abstractmethod
def retrieve_results(self, agent_id: int) -> Any:
"""Retrieve results from a specific agent"""
@ -159,7 +159,7 @@ class Orchestrator(ABC):
logging.error(f"Failed to retrieve results from agent {agent_id}. Error {e}")
raise
@abstractmethod
# @abstractmethod
def update_vector_db(self, data) -> None:
"""Update the vector database"""
@ -175,7 +175,7 @@ class Orchestrator(ABC):
raise
@abstractmethod
# @abstractmethod
def get_vector_db(self):
"""Retrieve the vector database"""
return self.collection
@ -242,7 +242,13 @@ class Orchestrator(ABC):
ids=[f"{sender_id}_to_{receiver_id}"]
)
orchestrate = Orchestrator()
from swarms.workers.worker import Worker
orchestrate = Orchestrator(
Worker,
Worker,
task_queue=["what is your name"],
)
orchestrate.chat(
sender_id=1,
receiver_id=2,

@ -4,8 +4,9 @@ from typing import Optional
from langchain import OpenAI
from swarms.boss.boss_node import BossNode
from swarms.workers.worker_node import WorkerNode
from swarms.boss.boss_node import Boss
# from swarms.workers.worker_node import WorkerNode
from swarms.workers.worker import Worker
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
@ -38,14 +39,14 @@ class HierarchicalSwarm:
self.logging_enabled = logging_enabled
self.verbose = verbose
self.worker_node = WorkerNode(
self.worker_node = Worker(
openai_api_key=self.openai_api_key,
temperature=self.temperature,
human_in_the_loop=self.human_in_the_loop,
verbose=self.verbose
)
self.boss_node = BossNode(
self.boss_node = Boss(
api_key=self.openai_api_key,
worker_node=self.worker_node,
llm_class=OpenAI,

Loading…
Cancel
Save