pull/64/head
Kye 1 year ago
parent 95f569c9b2
commit 5d8e4d5968

@ -2,7 +2,7 @@ from swarms.swarms.multi_agent_debate import MultiAgentDebate, select_speaker
from swarms.workers.worker import Worker from swarms.workers.worker import Worker
from langchain.llms import OpenAIChat from langchain.llms import OpenAIChat
llm = OpenAIChat(model_name="gpt-4", openai_api_key="api-key", temperature=0.5) llm = OpenAIChat()
worker1 = Worker( worker1 = Worker(
llm=llm, llm=llm,

@ -22,9 +22,6 @@ from swarms.utils.decorators import error_decorator, log_decorator, timing_decor
# cache # cache
ROOT_DIR = "./data/" ROOT_DIR = "./data/"
# main
OPENAI_API_KEY = os.environ["OPENAI_API_KEY"]
class Worker: class Worker:
""" """
@ -73,7 +70,7 @@ class Worker:
self.temperature = temperature self.temperature = temperature
self.human_in_the_loop = human_in_the_loop self.human_in_the_loop = human_in_the_loop
self.llm = llm 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_name = ai_name
self.ai_role = ai_role self.ai_role = ai_role
self.setup_tools(external_tools) self.setup_tools(external_tools)
@ -145,9 +142,8 @@ class Worker:
""" """
Set up memory for the worker. Set up memory for the worker.
""" """
openai_api_key = OPENAI_API_KEY
try: try:
embeddings_model = OpenAIEmbeddings(openai_api_key=openai_api_key) embeddings_model = OpenAIEmbeddings(openai_api_key=self.openai_api_key)
embedding_size = 1536 embedding_size = 1536
index = faiss.IndexFlatL2(embedding_size) index = faiss.IndexFlatL2(embedding_size)

Loading…
Cancel
Save