Former-commit-id: a500b8298d
discord-bot-framework
Kye 2 years ago
parent a0643d9357
commit a9911fbb11

@ -14,13 +14,13 @@ class AutoScaler:
Args: Args:
initial_agents (int, optional): Number of initial agents. Defaults to 10. initial_agents (int, optional): Number of initial agents. Defaults to 10.
scale_up_factor (int, optional): Scale up factor. Defaults to 1. scale_up_factor (int, optional): Scale up factor. Defaults to 1.
idle_threshold (float, optional): Idle threshold. Defaults to 0.2. idle_threshold (float, optional): Idle threshold. Defaults to 0.2.
busy_threshold (float, optional): Busy threshold. Defaults to 0.7. busy_threshold (float, optional): Busy threshold. Defaults to 0.7.
agent ([type], optional): Agent. Defaults to None. agent ([type], optional): Agent. Defaults to None.
Methods: Methods:
add_task: Add task to queue add_task: Add task to queue
@ -29,7 +29,7 @@ class AutoScaler:
monitor_and_scale: Monitor and scale monitor_and_scale: Monitor and scale
start: Start scaling start: Start scaling
del_agent: Delete an agent del_agent: Delete an agent
Usage Usage
``` ```
# usage of usage # usage of usage

@ -2,11 +2,13 @@ from abc import ABC, abstractmethod
from typing import Optional, List, Dict, Any from typing import Optional, List, Dict, Any
from swarms.workers.base import AbstractWorker from swarms.workers.base import AbstractWorker
class AbstractSwarm(ABC): class AbstractSwarm(ABC):
""" """
Abstract class for swarm simulation architectures Abstract class for swarm simulation architectures
""" """
# TODO: Pass in abstract LLM class that can utilize Hf or Anthropic models, Move away from OPENAI # TODO: Pass in abstract LLM class that can utilize Hf or Anthropic models, Move away from OPENAI
# TODO: ADD Universal Communication Layer, a ocean vectorstore instance # TODO: ADD Universal Communication Layer, a ocean vectorstore instance
# TODO: BE MORE EXPLICIT ON TOOL USE, TASK DECOMPOSITION AND TASK COMPLETETION AND ALLOCATION # TODO: BE MORE EXPLICIT ON TOOL USE, TASK DECOMPOSITION AND TASK COMPLETETION AND ALLOCATION
@ -67,17 +69,17 @@ class AbstractSwarm(ABC):
): ):
"""Send a direct message to a worker""" """Send a direct message to a worker"""
pass pass
@abstractmethod @abstractmethod
def autoscaler(self, num_workers: int, worker: ["AbstractWorker"]): def autoscaler(self, num_workers: int, worker: ["AbstractWorker"]):
"""Autoscaler that acts like kubernetes for autonomous agents""" """Autoscaler that acts like kubernetes for autonomous agents"""
pass pass
@abstractmethod @abstractmethod
def get_worker_by_id(self, id: str) -> "AbstractWorker": def get_worker_by_id(self, id: str) -> "AbstractWorker":
"""Locate a worker by id""" """Locate a worker by id"""
pass pass
@abstractmethod @abstractmethod
def get_worker_by_name(self, name: str) -> "AbstractWorker": def get_worker_by_name(self, name: str) -> "AbstractWorker":
"""Locate a worker by name""" """Locate a worker by name"""
@ -91,7 +93,7 @@ class AbstractSwarm(ABC):
@abstractmethod @abstractmethod
def get_all_tasks(self, worker: "AbstractWorker", task: Any): def get_all_tasks(self, worker: "AbstractWorker", task: Any):
"""Get all tasks""" """Get all tasks"""
@abstractmethod @abstractmethod
def get_finished_tasks(self) -> List[Dict]: def get_finished_tasks(self) -> List[Dict]:
"""Get all finished tasks""" """Get all finished tasks"""
@ -156,6 +158,3 @@ class AbstractSwarm(ABC):
def save_swarm_state(self): def save_swarm_state(self):
"""Save the swarm state""" """Save the swarm state"""
pass pass

Loading…
Cancel
Save