From 0ad98637053331515b0564071132af7341d56ade Mon Sep 17 00:00:00 2001 From: Kye Date: Thu, 6 Jul 2023 14:19:09 -0400 Subject: [PATCH] In this updated code, I've removed the verbose parameter from BossNode and BabyAGI.from_llm as it's not mentioned in the BabyAGI setup code you shared. I've also removed the assert isinstance(llm, dict) check, as llm is expected to be an instance of OpenAI or a similar class, not a dictionary. --- swarms/agents/boss/boss_agent.py | 26 ++++---------------------- swarms/swarms.py | 4 ++-- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/swarms/agents/boss/boss_agent.py b/swarms/agents/boss/boss_agent.py index de985d63..216c2be1 100644 --- a/swarms/agents/boss/boss_agent.py +++ b/swarms/agents/boss/boss_agent.py @@ -3,38 +3,20 @@ from pydantic import ValidationError # ---------- Boss Node ---------- class BossNode: - def __init__(self, llm, vectorstore, task_execution_chain, verbose, max_iterations): + def __init__(self, llm, vectorstore, agent_executor, max_iterations): self.llm = llm self.vectorstore = vectorstore - self.task_execution_chain = task_execution_chain - self.verbose = verbose + self.agent_executor = agent_executor self.max_iterations = max_iterations try: - # Ensure llm is a dictionary before passing it to BabyAGI - assert isinstance(llm, dict), "llm should be a dictionary." - self.baby_agi = BabyAGI.from_llm( llm=self.llm, vectorstore=self.vectorstore, - task_execution_chain=self.task_execution_chain, - verbose=self.verbose, + task_execution_chain=self.agent_executor, max_iterations=self.max_iterations, ) except ValidationError as e: print(f"Validation Error while initializing BabyAGI: {e}") except Exception as e: - print(f"Unexpected Error while initializing BabyAGI: {e}") - - def create_task(self, objective): - try: - task = {"objective": objective} - return task - except Exception as e: - print(f"Unexpected Error while creating a task: {e}") - - def execute_task(self, task): - try: - self.baby_agi(task) - except Exception as e: - print(f"Unexpected Error while executing a task: {e}") \ No newline at end of file + print(f"Unexpected Error while initializing BabyAGI: {e}") \ No newline at end of file diff --git a/swarms/swarms.py b/swarms/swarms.py index d07ba090..4a59aa5d 100644 --- a/swarms/swarms.py +++ b/swarms/swarms.py @@ -12,9 +12,9 @@ class Swarms: def __init__(self, openai_api_key): self.openai_api_key = openai_api_key - def initialize_llm(self, llm_class): + def initialize_llm(self, llm_class, temperature=0.5): # Initialize language model - return llm_class(openai_api_key=self.openai_api_key) + return llm_class(openai_api_key=self.openai_api_key, temperature=temperature) def initialize_tools(self, llm_class): llm = self.initialize_llm(llm_class)