Former-commit-id: 388fc192e2ef680677e909197b627fa93512504f
pull/160/head
Kye 2 years ago
parent 5a4ae8ef77
commit 74087c58a2

@ -4,11 +4,18 @@ import threading
# from abc import ABC, abstractmethod # from abc import ABC, abstractmethod
from concurrent.futures import ThreadPoolExecutor from concurrent.futures import ThreadPoolExecutor
from typing import Any, Dict, List from typing import Any, Dict, List
from enum import Enum
import chromadb import chromadb
from chromadb.utils import embedding_functions from chromadb.utils import embedding_functions
class TaskStatus(Enum):
QUEUED = 1
RUNNING = 2
COMPLETED = 3
FAILED = 4
class Orchestrator: class Orchestrator:
""" """
The Orchestrator takes in an agent, worker, or boss as input The Orchestrator takes in an agent, worker, or boss as input
@ -71,7 +78,8 @@ class Orchestrator:
task_queue: List[Any], task_queue: List[Any],
collection_name: str = "swarm", collection_name: str = "swarm",
api_key: str = None, api_key: str = None,
model_name: str = None model_name: str = None,
embed_func = None
): ):
self.agent = agent self.agent = agent
self.agents = queue.Queue() self.agents = queue.Queue()
@ -93,6 +101,8 @@ class Orchestrator:
self.condition = threading.Condition(self.lock) self.condition = threading.Condition(self.lock)
self.executor = ThreadPoolExecutor(max_workers=len(agent_list)) self.executor = ThreadPoolExecutor(max_workers=len(agent_list))
self.embed_func = embed_func if embed_func else self.embed
# @abstractmethod # @abstractmethod
def assign_task( def assign_task(

Loading…
Cancel
Save