From 8f4d70f89f828262020d45a6f804b6130330baab Mon Sep 17 00:00:00 2001 From: Kye Date: Thu, 14 Sep 2023 18:31:36 -0400 Subject: [PATCH] vector representation --- swarms/swarms/orchestrate.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/swarms/swarms/orchestrate.py b/swarms/swarms/orchestrate.py index c6b3d50b..cf9518fe 100644 --- a/swarms/swarms/orchestrate.py +++ b/swarms/swarms/orchestrate.py @@ -70,7 +70,9 @@ class Orchestrator(ABC): agent, agent_list: List[Any], task_queue: List[Any], - collection_name: str = "swarm" + collection_name: str = "swarm", + api_key: str = None, + model_name: str = None ): self.agent = agent self.agents = queue.Queue() @@ -109,9 +111,15 @@ class Orchestrator(ABC): task = self.task_queue.get() try: - result, vector_representation = agent.process_task( - task + result = self.worker.run(task["content"]) + + #using the embed method to get the vector representation of the result + vector_representation = self.embed( + result, + self.api_key, + self.model_name ) + self.collection.add( embeddings=[vector_representation], documents=[str(id(task))], @@ -131,14 +139,8 @@ class Orchestrator(ABC): api_key=api_key, model_name=model_name ) - embedding = openai(input) - # print(embedding) - - embedding_metadata = {input: embedding} - print(embedding_metadata) - - # return embedding + return embedding @abstractmethod