init clean up

Former-commit-id: f43d7b6b71e57f5a90fcd92657bac0129840e549
pull/160/head
Kye 2 years ago
parent cfce7d7eff
commit 8c874cb877

@ -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(),

Loading…
Cancel
Save