From 9416d064950c41aacedca8c8b3bbd7cfb17972c9 Mon Sep 17 00:00:00 2001 From: Kye Date: Wed, 20 Sep 2023 09:46:09 -0400 Subject: [PATCH] just testing communicate method for the orchestrator Former-commit-id: 5ace98e9274e457dbc950e1d44c5e46690d44420 --- swarms/swarms/orchestrate.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/swarms/swarms/orchestrate.py b/swarms/swarms/orchestrate.py index 82b760f8..a5d382fb 100644 --- a/swarms/swarms/orchestrate.py +++ b/swarms/swarms/orchestrate.py @@ -220,4 +220,25 @@ class Orchestrator(ABC): except Exception as e: logging.error(f"An error occured in swarm: {e}") return None + + def communicate( + self, + sender_id: int, + receiver_id: int, + message: str + ): + """Allows the agents to communicate with eachother thrught the vectordatabase""" + + message_vector = self.embed( + message, + self.api_key, + self.model_name + ) + + #store the mesage in the vector database + self.collection.add( + embeddings=[message_vector], + documents=[message], + ids=[f"{sender_id}_to_{receiver_id}"] + )