From b96f3ce7dcc13329dac97609522d86923bbab0fc Mon Sep 17 00:00:00 2001 From: Kye Date: Thu, 27 Jul 2023 16:30:23 -0400 Subject: [PATCH] clean up Former-commit-id: f99f6d667f359bfeb34a5f3cdd02ac035bfbbcbe --- playground/DIY/hierchical.py | 29 +++++++++++++++++++++++++++++ swarms/swarms.py | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 playground/DIY/hierchical.py diff --git a/playground/DIY/hierchical.py b/playground/DIY/hierchical.py new file mode 100644 index 00000000..983c1875 --- /dev/null +++ b/playground/DIY/hierchical.py @@ -0,0 +1,29 @@ +from swarms import HierarchicalSwarm + + +swarm = HierarchicalSwarm( + openai_api_key="key", + model_type="openai", + model_id="gpt-4", + use_vectorstore=False, + use_async=False, + human_in_the_loop=False, + logging_enabled=False +) + +#run the swarm with an objective +result = swarm.run("Design a new car") + +#or huggingface +swarm = HierarchicalSwarm( + model_type="huggingface", + model_id="tiaueu/falcon", + use_vectorstore=True, + embedding_size=768, + use_async=False, + human_in_the_loop=True, + logging_enabled=False, +) + +# Run the swarm with a particular objective +result = swarm.run("Write a sci-fi short story") diff --git a/swarms/swarms.py b/swarms/swarms.py index c47cf93d..8081713f 100644 --- a/swarms/swarms.py +++ b/swarms/swarms.py @@ -123,7 +123,7 @@ class HierarchicalSwarm: logging.error(f"Failed to initialize vector store: {e}") return None - def initialize_worker_node(self, worker_tools, vectorstore, llm_class=ChatOpenAI, ai_name="Swarm Worker AI Assistant", human_in_the_loop=True): + def initialize_worker_node(self, worker_tools, vectorstore, llm_class=ChatOpenAI, ai_name="Swarm Worker AI Assistant",): """ Init WorkerNode