worker node tool langchain setup

main
Kye 2 years ago
parent 2a197705d7
commit 2b7d620d22

@ -1,21 +1,13 @@
from swarms.tools.agent_tools import *
from langchain.tools import BaseTool
from langchain.tools import BaseTool, tool
from typing import Optional, Type
from langchain.callbacks.manager import (
AsyncCallbackManagerForToolRun,
CallbackManagerForToolRun,
)
from langchain.tools import tool
# ---------- Worker Node ----------
from pydantic import Field
#
@tool
class WorkerNode():
class WorkerNode(BaseTool):
"""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 """
# name = "WorkerNode"
# description = "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):
super().__init__()
@ -34,6 +26,10 @@ class WorkerNode():
)
self.agent.chain.verbose = True
@tool(
name="Worker AutoBot Agent",
description="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 _run(
self, prompt: str, run_manager: Optional[CallbackManagerForToolRun] = None
) -> str:

Loading…
Cancel
Save