Former-commit-id: 726c309ce5
group-chat
Kye 1 year ago
parent d4f8485151
commit cfc04c1cf6

@ -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()
@ -92,6 +100,8 @@ class Orchestrator:
self.lock = threading.Lock() self.lock = threading.Lock()
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

Loading…
Cancel
Save