From e9bf07410c435cf771dc40c9391dfd78343aebf9 Mon Sep 17 00:00:00 2001 From: Kye Date: Mon, 8 Apr 2024 19:23:48 -0400 Subject: [PATCH] [CLEANUP] --- README.md | 2 +- neo_sapiens/hass_schema.py | 4 +- neo_sapiens/main.py | 104 ------------------------------------- pyproject.toml | 2 +- 4 files changed, 5 insertions(+), 107 deletions(-) delete mode 100644 neo_sapiens/main.py diff --git a/README.md b/README.md index 76d61ea..909882b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ## install -`$ pip install -U swarms` +`$ pip install -U swarms neo-sapiens` ## usage diff --git a/neo_sapiens/hass_schema.py b/neo_sapiens/hass_schema.py index 22b4d76..7c308bd 100644 --- a/neo_sapiens/hass_schema.py +++ b/neo_sapiens/hass_schema.py @@ -194,7 +194,7 @@ def create_agents( # print(out) -def run_task(task: str = None,): +def run_task(task: str = None): agent = Agent( agent_name="Swarm Orchestrator", system_prompt=None, @@ -213,4 +213,6 @@ def run_task(task: str = None,): parsed_schema = parse_hass_schema(json) plan, number_of_agents, agents = parsed_schema agents = create_agents(agents) + # Run the agents + \ No newline at end of file diff --git a/neo_sapiens/main.py b/neo_sapiens/main.py deleted file mode 100644 index 9ed2aba..0000000 --- a/neo_sapiens/main.py +++ /dev/null @@ -1,104 +0,0 @@ -from swarms import Agent, tool, OpenAIChat -import subprocess - -# Model -llm = OpenAIChat() - - -# Tools -@tool -def terminal( - code: str, -): - """ - Run code in the terminal. - - Args: - code (str): The code to run in the terminal. - - Returns: - str: The output of the code. - """ - out = subprocess.run( - code, shell=True, capture_output=True, text=True - ).stdout - return str(out) - - -@tool -def browser(query: str): - """ - Search the query in the browser with the `browser` tool. - - Args: - query (str): The query to search in the browser. - - Returns: - str: The search results. - """ - import webbrowser - - url = f"https://www.google.com/search?q={query}" - webbrowser.open(url) - return f"Searching for {query} in the browser." - - -@tool -def create_file(file_path: str, content: str): - """ - Create a file using the file editor tool. - - Args: - file_path (str): The path to the file. - content (str): The content to write to the file. - - Returns: - str: The result of the file creation operation. - """ - with open(file_path, "w") as file: - file.write(content) - return f"File {file_path} created successfully." - - -@tool -def file_editor(file_path: str, mode: str, content: str): - """ - Edit a file using the file editor tool. - - Args: - file_path (str): The path to the file. - mode (str): The mode to open the file in. - content (str): The content to write to the file. - - Returns: - str: The result of the file editing operation. - """ - with open(file_path, mode) as file: - file.write(content) - return f"File {file_path} edited successfully." - - -# Agent -agent = Agent( - agent_name="Neo Sapien orchestrator", - system_prompt=( - "Autonomous agent that can interact with humans and other" - " agents. Be Helpful and Kind. Use the tools provided to" - " assist the user. Return all code in markdown format." - ), - llm=llm, - max_loops="auto", - autosave=True, - dashboard=False, - streaming_on=True, - verbose=True, - stopping_token="", - interactive=True, - tools=[terminal, browser, file_editor, create_file], - code_interpreter=True, - # streaming=True, -) - -# Run the agent -out = agent("Create a new file for a plan to take over the world.") -print(out) diff --git a/pyproject.toml b/pyproject.toml index fadd853..ea199ad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "neo-sapiens" -version = "0.0.1" +version = "0.0.2" description = "Neo Sapiens - Pytorch" license = "MIT" authors = ["Kye Gomez "]