[CLEANUP CHORES]

pull/286/head
Kye 1 year ago
parent 39888fcb3b
commit ba316eba07

@ -1,2 +0,0 @@
[flake8]
extend-ignore = E501, W292, W291, W293

2
.gitignore vendored

@ -36,7 +36,7 @@ error.txt
errors.txt
Autonomous-Agent-XYZ1B_state.json
# Distribution / packaging
.Python
build/

@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "swarms"
version = "2.6.1"
version = "2.6.2"
description = "Swarms - Pytorch"
license = "MIT"
authors = ["Kye Gomez <kye@apac.ai>"]

@ -1,40 +1,76 @@
# import argparse
# import sys
# def run_file():
# parser = argparse.ArgumentParser(description='Swarms CLI')
# parser.add_argument('file_name', help='Python file containing Swarms code to run')
# # Help message for the -h flag is automatically generated by argparse
# parser.add_argument('-v', '--version', action='version', version='%(prog)s 0.1.0')
# # Check deployments for a given model
# parser.add_argument('-c', '--check', help='Check deployments for a given agent')
# args = parser.parse_args()
# # Execute the specified file
# try:
# with open(args.file_name, 'r') as file:
# exec(file.read(), globals())
# except FileNotFoundError:
# print(f"Error: File '{args.file_name}' not found.")
# sys.exit(1)
# except Exception as e:
# print(f"Error executing file '{args.file_name}': {e}")
# sys.exit(1)
# if __name__ == '__main__':
# main()
# swarms/cli/_cli.py
import argparse
import sys
import subprocess
def run_file():
if len(sys.argv) != 3 or sys.argv[1] != "run":
print("Usage: swarms run file_name.py")
parser = argparse.ArgumentParser(description="Swarms CLI")
parser.add_argument(
"file_name", help="Python file containing Swarms code to run"
)
# Help message for the -h flag is automatically generated by argparse
parser.add_argument(
"-v", "--version", action="version", version="%(prog)s 0.1.0"
)
# Check deployments for a given model
parser.add_argument(
"-c", "--check", help="Check deployments for a given agent"
)
# Generate an API key for a given agent
parser.add_argument(
"-g",
"--generate",
help="Generate an API key for a given agent",
)
# Signin to swarms with a given API key
parser.add_argument(
"-s", "--signin", help="Signin to swarms with a given API key"
)
# Signout of swarms
parser.add_argument("-o", "--signout", help="Signout of swarms")
# List all agents
parser.add_argument("-l", "--list", help="List all agents")
# List all deployments
parser.add_argument(
"-d", "--deployments", help="List all deployments"
)
# Pricing information
parser.add_argument("-p", "--pricing", help="Pricing information")
# Run a deployment
parser.add_argument("-r", "--run", help="Run a deployment")
# Stop a deployment
parser.add_argument("-t", "--stop", help="Stop a deployment")
# Delete a deployment
parser.add_argument("-x", "--delete", help="Delete a deployment")
# Get a deployment
parser.add_argument("-e", "--get", help="Get a deployment")
# Get a deployment's logs
parser.add_argument(
"-z", "--logs", help="Get a deployment's logs"
)
# Parse the arguments
args = parser.parse_args()
# Execute the specified file
try:
with open(args.file_name, "r") as file:
exec(file.read(), globals())
except FileNotFoundError:
print(f"Error: File '{args.file_name}' not found.")
sys.exit(1)
except Exception as e:
print(f"Error executing file '{args.file_name}': {e}")
sys.exit(1)
file_name = sys.argv[2]
subprocess.run(["python", file_name], check=True)

@ -0,0 +1,15 @@
import sys
import subprocess
def run_file():
"""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)

@ -192,6 +192,8 @@ class Agent:
tokenizer: Optional[Any] = None,
memory: Optional[VectorDatabase] = None,
preset_stopping_token: Optional[bool] = False,
traceback: Any = None,
traceback_handlers: Any = None,
*args,
**kwargs: Any,
):
@ -232,6 +234,8 @@ class Agent:
self.tokenizer = tokenizer
self.memory = memory
self.preset_stopping_token = preset_stopping_token
self.traceback = traceback
self.traceback_handlers = traceback_handlers
# self.system_prompt = AGENT_SYSTEM_PROMPT_3

Loading…
Cancel
Save