From b069672488f493fec15b4b9f5ba4a10dd9907176 Mon Sep 17 00:00:00 2001 From: Kye Date: Thu, 6 Jul 2023 13:46:25 -0400 Subject: [PATCH] workernode types --- swarms/agents/workers/worker.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/swarms/agents/workers/worker.py b/swarms/agents/workers/worker.py index cb097446..89fedeaf 100644 --- a/swarms/agents/workers/worker.py +++ b/swarms/agents/workers/worker.py @@ -6,16 +6,21 @@ from langchain.callbacks.manager import ( AsyncCallbackManagerForToolRun, CallbackManagerForToolRun, ) -from typing import List, Any, Dict +from typing import List, Any, Dict, Optional from langchain.memory.chat_message_histories import FileChatMessageHistory import logging +from pydantic import BaseModel, Extra logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s') class WorkerNodeArgs(BaseModel): prompt: str run_manager: Optional[CallbackManagerForToolRun] = None + class Config: + arbitrary_types_allowed = True + extra = Extra.forbid + @tool("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"""