From d8b42f08e730689985a4216c6f1c0b4b91926d8f Mon Sep 17 00:00:00 2001 From: Kye Date: Mon, 1 Apr 2024 19:13:25 -0700 Subject: [PATCH] [CLEANUP] --- pyproject.toml | 6 +---- rearrange_agent_example.py | 5 ++-- swarms/cli/__init__.py | 0 swarms/cli/_cli.py | 54 -------------------------------------- swarms/cli/run_file.py | 16 ----------- 5 files changed, 4 insertions(+), 77 deletions(-) delete mode 100644 swarms/cli/__init__.py delete mode 100644 swarms/cli/_cli.py delete mode 100644 swarms/cli/run_file.py diff --git a/pyproject.toml b/pyproject.toml index 3d15285e..50cf3eed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "swarms" -version = "4.7.0" +version = "4.7.1" description = "Swarms - Pytorch" license = "MIT" authors = ["Kye Gomez "] @@ -68,7 +68,3 @@ unfixable = [] line-length = 70 target-version = ['py38'] preview = true - - -[tool.poetry.scripts] -swarms = 'swarms.cli._cli:main' \ No newline at end of file diff --git a/rearrange_agent_example.py b/rearrange_agent_example.py index d4ac714c..8f8d2ce3 100644 --- a/rearrange_agent_example.py +++ b/rearrange_agent_example.py @@ -2,10 +2,10 @@ import logging from collections import defaultdict from typing import Callable, Sequence from swarms import Agent, Anthropic - +from swarms.structs.base_swarm import BaseSwarm # Assuming the existence of an appropriate Agent class and logger setup -class AgentRearrange: +class AgentRearrange(BaseSwarm): def __init__( self, agents: Sequence[Agent] = None, @@ -13,6 +13,7 @@ class AgentRearrange: custom_prompt: str = None, callbacks: Sequence[Callable] = None, ): + super().__init__() if not all(isinstance(agent, Agent) for agent in agents): raise ValueError( "All elements must be instances of the Agent class." diff --git a/swarms/cli/__init__.py b/swarms/cli/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/swarms/cli/_cli.py b/swarms/cli/_cli.py deleted file mode 100644 index 831f1718..00000000 --- a/swarms/cli/_cli.py +++ /dev/null @@ -1,54 +0,0 @@ -import argparse - -from swarms.agents.simple_agent import SimpleAgent, get_llm_by_name - - -def main(): - parser = argparse.ArgumentParser( - prog="swarms", - description=( - "Run the SimpleAgent with a specified language model." - ), - ) - subparsers = parser.add_subparsers(dest="command") - - run_parser = subparsers.add_parser( - "run", help="Run the SimpleAgent." - ) - run_parser.add_argument( - "modelname", - type=str, - help="The name of the language model to use.", - ) - run_parser.add_argument( - "--iters", - type=int, - default="automatic", - help=( - 'Number of iterations or "automatic" for infinite loop.' - ' Defaults to "automatic".' - ), - ) - - # Add a help command - help_parser = subparsers.add_parser( - "help", help="Show this help message and exit." - ) - help_parser.set_defaults(func=lambda args: parser.print_help()) - - args = parser.parse_args() - - if hasattr(args, "func"): - args.func(args) - elif args.command == "run": - llm = get_llm_by_name(args.modelname) - if llm is None: - raise ValueError( - "No language model found with name" - f" '{args.modelname}'" - ) - SimpleAgent(llm, iters=args.iters) - - -# if __name__ == "__main__": -# main() diff --git a/swarms/cli/run_file.py b/swarms/cli/run_file.py deleted file mode 100644 index 60b621a3..00000000 --- a/swarms/cli/run_file.py +++ /dev/null @@ -1,16 +0,0 @@ -import subprocess -import sys - - -def run_file(filename: str): - """Run a given file. - - Usage: swarms run file_name.py - - """ - if len(sys.argv) != 3 or sys.argv[1] != "run": - print("Usage: swarms run file_name.py") - sys.exit(1) - - file_name = sys.argv[2] - subprocess.run(["python", file_name], check=True)