From ad151293c1dc27c2dcc811a3aaf63fb33013c80c Mon Sep 17 00:00:00 2001 From: Kye Date: Mon, 8 Apr 2024 17:31:18 -0400 Subject: [PATCH] [CLEANUP] --- README.md | 57 +++----------------------------- Room Management Agent_state.json | 4 +-- neo_sapiens/few_shot_prompts.py | 3 +- neo_sapiens/hass_schema.py | 49 +++++++++++++++++++++------ pyproject.toml | 17 ++++------ 5 files changed, 52 insertions(+), 78 deletions(-) diff --git a/README.md b/README.md index b2d5137..76d61ea 100644 --- a/README.md +++ b/README.md @@ -1,62 +1,13 @@ [![Multi-Modality](agorabanner.png)](https://discord.gg/qUtxnK2NMf) -# Python Package Template -A easy, reliable, fluid template for python packages complete with docs, testing suites, readme's, github workflows, linting and much much more +# Neo Sapiens -## Installation +## install +`$ pip install -U swarms` -You can install the package using pip -```bash -pip install -e . -``` - -# Usage -```python -print("hello world") - -``` - - - -### Code Quality ๐Ÿงน - -- `make style` to format the code -- `make check_code_quality` to check code quality (PEP8 basically) -- `black .` -- `ruff . --fix` - -### Tests ๐Ÿงช - -[`pytests`](https://docs.pytest.org/en/7.1.x/) is used to run our tests. - -### Publish on PyPi ๐Ÿš€ - -**Important**: Before publishing, edit `__version__` in [src/__init__](/src/__init__.py) to match the wanted new version. - -``` -poetry build -poetry publish -``` - -### CI/CD ๐Ÿค– - -We use [GitHub actions](https://github.com/features/actions) to automatically run tests and check code quality when a new PR is done on `main`. - -On any pull request, we will check the code quality and tests. - -When a new release is created, we will try to push the new code to PyPi. We use [`twine`](https://twine.readthedocs.io/en/stable/) to make our life easier. - -The **correct steps** to create a new realease are the following: -- edit `__version__` in [src/__init__](/src/__init__.py) to match the wanted new version. -- create a new [`tag`](https://git-scm.com/docs/git-tag) with the release name, e.g. `git tag v0.0.1 && git push origin v0.0.1` or from the GitHub UI. -- create a new release from GitHub UI - -The CI will run when you create the new release. - -# Docs -We use MK docs. This repo comes with the zeta docs. All the docs configurations are already here along with the readthedocs configs. +## usage diff --git a/Room Management Agent_state.json b/Room Management Agent_state.json index c20e679..2c36475 100644 --- a/Room Management Agent_state.json +++ b/Room Management Agent_state.json @@ -1,10 +1,10 @@ { - "agent_id": "", + "agent_id": "", "agent_name": "Room Management Agent", "agent_description": null, "system_prompt": "Automate room assignments, minibar restocking, and housekeeping schedules", "sop": null, - "short_memory": "system: Automate room assignments, minibar restocking, and housekeeping schedules\n\n\nHuman:: What is your name\n\n\nRoom Management Agent: content='I am a system designed to automate room assignments, minibar restocking, and housekeeping schedules.' response_metadata={'token_usage': {'completion_tokens': 20, 'prompt_tokens': 31, 'total_tokens': 51}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': 'fp_b28b39ffa8', 'finish_reason': 'stop', 'logprobs': None}\n\n\nHuman:: \u001b[31mcheck in Kye Gomez to room 120\u001b[0m\n\n", + "short_memory": "system: Automate room assignments, minibar restocking, and housekeeping schedules\n\n\nHuman:: What is your name\n\n\nRoom Management Agent: content='I am a system designed to automate room assignments, minibar restocking, and housekeeping schedules.' response_metadata={'token_usage': {'completion_tokens': 20, 'prompt_tokens': 31, 'total_tokens': 51}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': 'fp_b28b39ffa8', 'finish_reason': 'stop', 'logprobs': None}\n\n\nHuman:: \u001b[31m/usr/local/bin/python3 /Users/defalt/Desktop/Athena/research/NeoSapiens/neo_sapiens/hass_schema.py\u001b[0m\n\n", "loop_interval": 0, "retry_attempts": 3, "retry_interval": 1, diff --git a/neo_sapiens/few_shot_prompts.py b/neo_sapiens/few_shot_prompts.py index 285e76e..4b2be2f 100644 --- a/neo_sapiens/few_shot_prompts.py +++ b/neo_sapiens/few_shot_prompts.py @@ -1,4 +1,3 @@ - # Example usage data = """ { @@ -124,4 +123,4 @@ } ] } -""" \ No newline at end of file +""" diff --git a/neo_sapiens/hass_schema.py b/neo_sapiens/hass_schema.py index f9d1236..7eefd71 100644 --- a/neo_sapiens/hass_schema.py +++ b/neo_sapiens/hass_schema.py @@ -3,7 +3,6 @@ from pydantic import BaseModel, Field from swarms import Agent, OpenAIChat from swarms.utils.json_utils import base_model_to_json - from neo_sapiens.hass_schema import ( data, data1, @@ -12,6 +11,11 @@ data5, ) from neo_sapiens.main import browser, terminal +from swarms import SwarmNetwork + + +# Swarmnetowr +network = SwarmNetwork(api_enabled=True, logging_enabled=True) def tool_router(tool: str, *args, **kwargs): @@ -70,11 +74,11 @@ class HassSchema(BaseModel): description="List of agents to use for the problem", ) # Rules for the agents - rules: str = Field( - ..., - title="Rules for the agents", - description="Rules for the agents", - ) + # rules: str = Field( + # ..., + # title="Rules for the agents", + # description="Rules for the agents", + # ) def transform_schema_to_json(schema: BaseModel): @@ -100,11 +104,10 @@ def parse_hass_schema(data: str) -> tuple: hass_schema.plan, hass_schema.number_of_agents, hass_schema.agents, + # hass_schema.rules, ) - - def merge_plans_into_str( plan: List[str] = [data, data1, data2, data3] ) -> str: @@ -124,6 +127,19 @@ def merge_plans_into_str( plan, number_of_agents, agents = parsed_schema +def merge_rules_into_str(prompts: List[str]): + """ + Merge a list of prompts into a single string. + + Args: + prompts (List[str]): A list of prompts to be merged. + + Returns: + str: The merged prompts as a single string. + """ + return "\n".join(prompts) + + def create_agents( agents: List[AgentSchema], ): @@ -149,7 +165,7 @@ def create_agents( agent_name=name, system_prompt=system_prompt, llm=OpenAIChat( - openai_api_key=None, + openai_api_key="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", ), max_loops="auto", autosave=True, @@ -159,10 +175,21 @@ def create_agents( interactive=True, ) - out("What is your name") + network.add_agent(out) return out out = create_agents(agents) -print(out) +# print(out) + +# Use network +list_agents = network.list_agents() +print(list_agents) + +# # Run the workflow on a task +# run = network.run_single_agent( +# agent2.id, "What's your name?" +# ) +# print(out) + diff --git a/pyproject.toml b/pyproject.toml index 5d4ac8e..fadd853 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,15 +3,15 @@ requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" [tool.poetry] -name = "paper" +name = "neo-sapiens" version = "0.0.1" -description = "Paper - Pytorch" +description = "Neo Sapiens - Pytorch" license = "MIT" authors = ["Kye Gomez "] -homepage = "https://github.com/kyegomez/paper" -documentation = "https://github.com/kyegomez/paper" # Add this if you have documentation. +homepage = "https://github.com/kyegomez/NeoSapiens" +documentation = "https://github.com/kyegomez/NeoSapiens" # Add this if you have documentation. readme = "README.md" # Assuming you have a README.md -repository = "https://github.com/kyegomez/paper" +repository = "https://github.com/kyegomez/NeoSapiens" keywords = ["artificial intelligence", "deep learning", "optimizers", "Prompt Engineering"] classifiers = [ "Development Status :: 4 - Beta", @@ -22,12 +22,9 @@ classifiers = [ ] [tool.poetry.dependencies] -python = "^3.6" +python = "^3.9" swarms = "*" -zetascale = "*" - -[tool.poetry.dev-dependencies] -# Add development dependencies here +pydantic = "*" [tool.poetry.group.lint.dependencies]