Former-commit-id: e747a7903d
huggingface
Kye 1 year ago
parent de1fdb2080
commit 9a1a7f9ee7

@ -15,7 +15,7 @@ logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(
from swarms.agents.tools.main import Terminal from swarms.agents.tools.main import Terminal
class WorkerNode: class WorkerNodeInitializer:
"""Useful for when you need to spawn an autonomous agent instance as a worker to accomplish complex tasks, it can search the internet or spawn child multi-modality models to process and generate images and text or audio and so on""" """Useful for when you need to spawn an autonomous agent instance as a worker to accomplish complex tasks, it can search the internet or spawn child multi-modality models to process and generate images and text or audio and so on"""
def __init__(self, llm, tools, vectorstore): def __init__(self, llm, tools, vectorstore):
@ -73,7 +73,7 @@ class WorkerNode:
class WorkerNodeInitializer: class WorkerNode:
def __init__(self, openai_api_key): def __init__(self, openai_api_key):
if not openai_api_key: if not openai_api_key:
logging.error("OpenAI API key is not provided") logging.error("OpenAI API key is not provided")

@ -3,7 +3,7 @@ import asyncio
# from swarms.agents.tools.agent_tools import * # from swarms.agents.tools.agent_tools import *
from swarms.agents.tools.agent_tools import * from swarms.agents.tools.agent_tools import *
from swarms.agents.workers.WorkerNode import WorkerNode, worker_node from swarms.agents.workers.WorkerNode import WorkerNodeInitializer, worker_node
from swarms.agents.boss.BossNode import BossNodeInitializer as BossNode from swarms.agents.boss.BossNode import BossNodeInitializer as BossNode
from swarms.agents.workers.worker_ultra_node import WorkerUltra from swarms.agents.workers.worker_ultra_node import WorkerUltra
@ -103,7 +103,7 @@ class Swarms:
# Initialize worker node # Initialize worker node
llm = self.initialize_llm(ChatOpenAI) llm = self.initialize_llm(ChatOpenAI)
worker_node = WorkerNode(llm=llm, tools=worker_tools, vectorstore=vectorstore) worker_node = WorkerNodeInitializer(llm=llm, tools=worker_tools, vectorstore=vectorstore)
worker_node.create_agent(ai_name=ai_name, ai_role="Assistant", human_in_the_loop=False, search_kwargs={}) # add search kwargs worker_node.create_agent(ai_name=ai_name, ai_role="Assistant", human_in_the_loop=False, search_kwargs={}) # add search kwargs
worker_node_tool = Tool(name="WorkerNode AI Agent", func=worker_node.run, description="Input: an objective with a todo list for that objective. Output: your task completed: Please be very clear what the objective and task instructions are. The Swarm worker agent is Useful for when you need to spawn an autonomous agent instance as a worker to accomplish any complex tasks, it can search the internet or write code or spawn child multi-modality models to process and generate images and text or audio and so on") worker_node_tool = Tool(name="WorkerNode AI Agent", func=worker_node.run, description="Input: an objective with a todo list for that objective. Output: your task completed: Please be very clear what the objective and task instructions are. The Swarm worker agent is Useful for when you need to spawn an autonomous agent instance as a worker to accomplish any complex tasks, it can search the internet or write code or spawn child multi-modality models to process and generate images and text or audio and so on")

Loading…
Cancel
Save