From 0de94f802f6f210322e23e080d9230bd7f6f576c Mon Sep 17 00:00:00 2001 From: Kye Date: Tue, 17 Oct 2023 15:35:52 -0400 Subject: [PATCH] clean up --- swarms/apps/__init__.py | 5 +++++ swarms/apps/base.py | 26 ++++++++++++++++++++++++++ swarms/logo.py | 3 +-- swarms/workers/worker.py | 5 ++++- 4 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 swarms/apps/__init__.py create mode 100644 swarms/apps/base.py diff --git a/swarms/apps/__init__.py b/swarms/apps/__init__.py new file mode 100644 index 00000000..2fc683c1 --- /dev/null +++ b/swarms/apps/__init__.py @@ -0,0 +1,5 @@ +# from swarms.apps.base import App + +""" +from swarms.apps import App +""" \ No newline at end of file diff --git a/swarms/apps/base.py b/swarms/apps/base.py new file mode 100644 index 00000000..32813ddc --- /dev/null +++ b/swarms/apps/base.py @@ -0,0 +1,26 @@ + + +#base App class +class App: + """ + This is a base app class for examples + + Args: + worker: Worker Agent + + Usage + + app = App(Worker) + app.run() + + """ + def __init__( + self, + worker, + ): + self.worker = worker + self.worker.app = self + + def run(self, task): + """Run the app""" + pass diff --git a/swarms/logo.py b/swarms/logo.py index bfe3732b..4d4956bf 100644 --- a/swarms/logo.py +++ b/swarms/logo.py @@ -15,5 +15,4 @@ logo2 = """ /_______ / \__/\ / \____|__ /|____|_ /\____|__ //_______ / \/ \/ \/ \/ \/ \/ -""" -# print(logo2) +""" \ No newline at end of file diff --git a/swarms/workers/worker.py b/swarms/workers/worker.py index e7745890..be549c23 100644 --- a/swarms/workers/worker.py +++ b/swarms/workers/worker.py @@ -40,7 +40,7 @@ class Worker: - `llm` (ChatOpenAI): Pre-initialized ChatOpenAI model instance (optional). - `openai` (bool): If True, use the OpenAI language model; otherwise, use `llm` (default: True). - #Usage + Usage ``` from swarms import Worker @@ -91,6 +91,7 @@ class Worker: @property def name(self): + """Name of the agent""" return self.ai_name def receieve(self, name: str, message: str) -> None: @@ -104,9 +105,11 @@ class Worker: self.message_history.append(f"{name}: {message}") def send(self) -> str: + """Send message history.""" self.agent.run(task=self.message_history) def add(self, task, priority=0): + """Add a task to the task queue.""" self.task_queue.append((priority, task)) def setup_tools(self, external_tools):