From 8c874cb87740077498795d14d26938f158ffb245 Mon Sep 17 00:00:00 2001 From: Kye Date: Thu, 13 Jul 2023 13:54:24 -0400 Subject: [PATCH] init clean up Former-commit-id: f43d7b6b71e57f5a90fcd92657bac0129840e549 --- swarms/agents/utils/AgentManager.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/swarms/agents/utils/AgentManager.py b/swarms/agents/utils/AgentManager.py index 7b3fb35d..bfeea916 100644 --- a/swarms/agents/utils/AgentManager.py +++ b/swarms/agents/utils/AgentManager.py @@ -41,9 +41,6 @@ class AgentManager: builder = AgentBuilder(self.toolsets) builder.build_parser() - agent = builder.get_agent() - if not agent: - raise ValueError("Agent not created") callbacks = [] eval_callback = EVALCallbackHandler() @@ -55,12 +52,19 @@ class AgentManager: execution_callback.set_parser(builder.get_parser()) callbacks.append(execution_callback) + #llm init callback_manager = CallbackManager(callbacks) - builder.build_llm(callback_manager, openai_api_key) + if builder.llm is None: + raise ValueError('LLM not created') builder.build_global_tools() + #agent init + agent = builder.get_agent() + if not agent: + raise ValueError("Agent not created") + memory: BaseChatMemory = self.get_or_create_memory(session) tools = [ *builder.get_global_tools(),