From 09fbaf0f29e98fd1b1fede4a36fcc84f53e872af Mon Sep 17 00:00:00 2001 From: Kye Date: Thu, 27 Jul 2023 19:46:21 -0400 Subject: [PATCH] MASSIVE CLEAN UP Former-commit-id: aa3bd5915feaa163b9c55ec5b8696d19e20c094e --- swarms/boss/boss_node.py | 13 +++++++++++-- swarms/swarms.py | 4 +--- swarms/workers/worker_node.py | 26 ++++++++++++++++++++++---- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/swarms/boss/boss_node.py b/swarms/boss/boss_node.py index 5ccb0b7d..f8151cda 100644 --- a/swarms/boss/boss_node.py +++ b/swarms/boss/boss_node.py @@ -1,7 +1,16 @@ -from pydantic import ValidationError import logging +import os + +import faiss +from langchain import LLMChain, OpenAI, PromptTemplate +from langchain.agents import AgentExecutor, Tool, ZeroShotAgent +from langchain.docstore import InMemoryDocstore +from langchain.embeddings import OpenAIEmbeddings +from langchain.experimental import BabyAGI +from langchain.vectorstores import FAISS +from pydantic import ValidationError + -from swarms.agents.tools.agent_tools import * logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') diff --git a/swarms/swarms.py b/swarms/swarms.py index 71c02f08..02c3f70f 100644 --- a/swarms/swarms.py +++ b/swarms/swarms.py @@ -4,6 +4,7 @@ from typing import Optional import faiss from langchain import LLMChain, OpenAI, PromptTemplate +from langchain.agents import AgentExecutor, Tool, ZeroShotAgent from langchain.chains.qa_with_sources.loading import load_qa_with_sources_chain from langchain.chat_models import ChatOpenAI from langchain.docstore import InMemoryDocstore @@ -12,9 +13,6 @@ from langchain.tools import DuckDuckGoSearchRun from langchain.tools.file_management.read import ReadFileTool from langchain.tools.file_management.write import WriteFileTool from langchain.vectorstores import FAISS -from langchain.agents import ZeroShotAgent, Tool, AgentExecutor - - from swarms.agents.models.hf import HuggingFaceLLM diff --git a/swarms/workers/worker_node.py b/swarms/workers/worker_node.py index a61fc2a8..3f7af242 100644 --- a/swarms/workers/worker_node.py +++ b/swarms/workers/worker_node.py @@ -1,11 +1,30 @@ -from swarms.agents.tools.agent_tools import * +import logging +import faiss +from langchain.agents import Tool +from langchain.chains.qa_with_sources.loading import load_qa_with_sources_chain +from langchain.chat_models import ChatOpenAI +from langchain.docstore import InMemoryDocstore +from langchain.embeddings import OpenAIEmbeddings +from langchain.experimental.autonomous_agents.autogpt.agent import AutoGPT from langchain.memory.chat_message_histories import FileChatMessageHistory +from langchain.tools import DuckDuckGoSearchRun +from langchain.tools.file_management.read import ReadFileTool +from langchain.tools.file_management.write import WriteFileTool +from langchain.vectorstores import FAISS + +# from langchain.tools.human.tool import HumanInputRun +from swarms.agents.tools.main import WebpageQATool, process_csv +from swarms.workers.worker_node import WorkerNodeInitializer + +logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') + + + +ROOT_DIR = "./data/" -import logging logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') -from swarms.agents.tools.main import Terminal 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""" @@ -100,7 +119,6 @@ class WorkerNode: ReadFileTool(root_dir=ROOT_DIR), process_csv, WebpageQATool(qa_chain=load_qa_with_sources_chain(llm)), - Terminal, ] if not tools: logging.error("Tools are not initialized")