From 5d8e4d596853545762bec62a960afaa2c394c846 Mon Sep 17 00:00:00 2001 From: Kye Date: Tue, 10 Oct 2023 18:24:51 -0400 Subject: [PATCH] clean up --- multi_agent_debate.py | 2 +- swarms/workers/worker.py | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/multi_agent_debate.py b/multi_agent_debate.py index 922c0599..11c5a28d 100644 --- a/multi_agent_debate.py +++ b/multi_agent_debate.py @@ -2,7 +2,7 @@ from swarms.swarms.multi_agent_debate import MultiAgentDebate, select_speaker from swarms.workers.worker import Worker from langchain.llms import OpenAIChat -llm = OpenAIChat(model_name="gpt-4", openai_api_key="api-key", temperature=0.5) +llm = OpenAIChat() worker1 = Worker( llm=llm, diff --git a/swarms/workers/worker.py b/swarms/workers/worker.py index 4592ab17..6ad9d930 100644 --- a/swarms/workers/worker.py +++ b/swarms/workers/worker.py @@ -22,9 +22,6 @@ from swarms.utils.decorators import error_decorator, log_decorator, timing_decor # cache ROOT_DIR = "./data/" -# main -OPENAI_API_KEY = os.environ["OPENAI_API_KEY"] - class Worker: """ @@ -73,7 +70,7 @@ class Worker: self.temperature = temperature self.human_in_the_loop = human_in_the_loop self.llm = llm - self.openai_api_key = openai_api_key or OPENAI_API_KEY + self.openai_api_key = openai_api_key self.ai_name = ai_name self.ai_role = ai_role self.setup_tools(external_tools) @@ -145,9 +142,8 @@ class Worker: """ Set up memory for the worker. """ - openai_api_key = OPENAI_API_KEY try: - embeddings_model = OpenAIEmbeddings(openai_api_key=openai_api_key) + embeddings_model = OpenAIEmbeddings(openai_api_key=self.openai_api_key) embedding_size = 1536 index = faiss.IndexFlatL2(embedding_size) @@ -283,4 +279,4 @@ class Worker: if isinstance(message, str): return {"content": message} else: - return message \ No newline at end of file + return message