Skip to content

Commit

Permalink
[CLEANUP]
Browse files Browse the repository at this point in the history
  • Loading branch information
Kye committed Apr 8, 2024
1 parent b7577ed commit ad15129
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 78 deletions.
57 changes: 4 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
@@ -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



Expand Down
4 changes: 2 additions & 2 deletions Room Management Agent_state.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"agent_id": "<function agent_id at 0x12f3a68e0>",
"agent_id": "<function agent_id at 0x12d77a8e0>",
"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,
Expand Down
3 changes: 1 addition & 2 deletions neo_sapiens/few_shot_prompts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Example usage
data = """
{
Expand Down Expand Up @@ -124,4 +123,4 @@
}
]
}
"""
"""
49 changes: 38 additions & 11 deletions neo_sapiens/hass_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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):
Expand Down Expand Up @@ -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):
Expand All @@ -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:
Expand All @@ -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],
):
Expand All @@ -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,
Expand All @@ -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)

17 changes: 7 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"]
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",
Expand All @@ -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]
Expand Down

0 comments on commit ad15129

Please sign in to comment.