From 570d50603983ccdf3a87894a982f1bb14062d44e Mon Sep 17 00:00:00 2001 From: Zack Date: Wed, 15 Nov 2023 09:59:29 -0600 Subject: [PATCH] refactor: fix importd Former-commit-id: 7fe13f0ce4d973835c963b8bfcb56f407039800d --- docs/corporate/research.md | 2 +- playground/tools/test.py | 2 +- playground/tools/test_multi.py | 4 ++-- swarms/tools/agent/BabyagiTools.py | 4 ++-- swarms/tools/agent/autogpt/agent.py | 2 +- swarms/tools/agent/autogptmulti/agent.py | 2 +- swarms/tools/agent/tools_controller.py | 10 +++++----- swarms/tools/airbnb/test.py | 4 ++-- swarms/tools/arxiv/test.py | 4 ++-- swarms/tools/database/api.py | 6 +++--- swarms/tools/database/readme.md | 2 +- swarms/tools/database/test.py | 4 ++-- swarms/tools/db_diag/api.py | 20 ++++++++++---------- swarms/tools/db_diag/readme.md | 4 ++-- swarms/tools/db_diag/test.py | 4 ++-- swarms/tools/file_operation/test.py | 4 ++-- swarms/tools/film/douban/test.py | 2 +- swarms/tools/google_places/test.py | 4 ++-- swarms/tools/google_scholar/test.py | 4 ++-- swarms/tools/google_serper/test.py | 4 ++-- swarms/tools/gradio_tools/test.py | 4 ++-- swarms/tools/hugging_tools/test.py | 4 ++-- swarms/tools/image_generation/test.py | 4 ++-- swarms/tools/job_search/test.py | 4 ++-- swarms/tools/kg/wikidata/test.py | 4 ++-- swarms/tools/map/baidu_map/test_baidu.py | 4 ++-- swarms/tools/map/bing_map/test.py | 4 ++-- swarms/tools/meta_analysis/test.py | 2 +- swarms/tools/python/test.py | 4 ++-- swarms/tools/sceneXplain/test.py | 4 ++-- swarms/tools/shell/test.py | 4 ++-- swarms/tools/stock/test.py | 4 ++-- swarms/tools/translation/baidu/test.py | 4 ++-- swarms/tools/translation/nllb/test.py | 4 ++-- swarms/tools/travel/test.py | 4 ++-- swarms/tools/tutorial/test.py | 4 ++-- swarms/tools/walmart/test.py | 2 +- swarms/tools/weather/test.py | 4 ++-- swarms/tools/wikipedia/test.py | 4 ++-- swarms/tools/wolframalpha/test.py | 4 ++-- swarms/tools/zillow/test.py | 4 ++-- swarms/utils/tool_logging.py | 14 +++++++------- 42 files changed, 93 insertions(+), 93 deletions(-) diff --git a/docs/corporate/research.md b/docs/corporate/research.md index bdfac22c..feff0605 100644 --- a/docs/corporate/research.md +++ b/docs/corporate/research.md @@ -14,7 +14,7 @@ A compilation of projects, papers, blogs in autonomous agents. ### Developer tools - [2023/8/10] [ModelScope-Agent](https://github.com/modelscope/modelscope-agent) - An Agent Framework Connecting Models in ModelScope with the World - [2023/05/25] [Gorilla](https://github.com/ShishirPatil/gorilla) - An API store for LLMs -- [2023/03/31] [BMTools](https://github.com/OpenBMB/BMTools) - Tool Learning for Big Models, Open-Source Solutions of ChatGPT-Plugins +- [2023/03/31] [swarms.tools](https://github.com/OpenBMB/swarms.tools) - Tool Learning for Big Models, Open-Source Solutions of ChatGPT-Plugins - [2023/03/09] [LMQL](https://github.com/eth-sri/lmql) - A query language for programming (large) language models. - [2022/10/25] [Langchain](https://github.com/hwchase17/langchain) - ⚡ Building applications with LLMs through composability ⚡ diff --git a/playground/tools/test.py b/playground/tools/test.py index eb381082..07c4e0bf 100644 --- a/playground/tools/test.py +++ b/playground/tools/test.py @@ -29,7 +29,7 @@ agent("write a weather report for SF today") """ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.agent.singletool import load_single_tools, STQuestionAnswerer tool_name, tool_url = 'wikipedia', "http://127.0.0.1:8079/tools/wikipedia/" tool_name, tool_config = load_single_tools(tool_name, tool_url) diff --git a/playground/tools/test_multi.py b/playground/tools/test_multi.py index fe1c764b..58c431f3 100644 --- a/playground/tools/test_multi.py +++ b/playground/tools/test_multi.py @@ -1,4 +1,4 @@ -from bmtools.agent.tools_controller import load_valid_tools, MTQuestionAnswerer +from swarms.agent.tools_controller import load_valid_tools, MTQuestionAnswerer tools_mappings = { 'weather': "http://127.0.0.1:8079/tools/weather/", 'file_operation': "http://127.0.0.1:8079/tools/file_operation/", @@ -10,4 +10,4 @@ qa = MTQuestionAnswerer(openai_api_key='', all_tools=tools) agent = qa.build_runner() -agent("what is the weather in Beijing?") \ No newline at end of file +agent("what is the weather in Beijing?") diff --git a/swarms/tools/agent/BabyagiTools.py b/swarms/tools/agent/BabyagiTools.py index 139a5b49..855ab96f 100644 --- a/swarms/tools/agent/BabyagiTools.py +++ b/swarms/tools/agent/BabyagiTools.py @@ -13,7 +13,7 @@ from langchain.vectorstores import FAISS import faiss from langchain.docstore import InMemoryDocstore from langchain.agents import ZeroShotAgent, Tool, AgentExecutor -from bmtools.agent.executor import Executor, AgentExecutorWithTranslation +from swarms.agent.executor import Executor, AgentExecutorWithTranslation class ContextAwareAgent(ZeroShotAgent): def get_full_inputs( @@ -314,4 +314,4 @@ if __name__ == "__main__": verbose=verbose, max_iterations=max_iterations ) - baby_agi({"objective": OBJECTIVE}) \ No newline at end of file + baby_agi({"objective": OBJECTIVE}) diff --git a/swarms/tools/agent/autogpt/agent.py b/swarms/tools/agent/autogpt/agent.py index e3581f2d..06d14961 100644 --- a/swarms/tools/agent/autogpt/agent.py +++ b/swarms/tools/agent/autogpt/agent.py @@ -108,7 +108,7 @@ class AutoGPT: if action.name in tools: tool = tools[action.name] try: - # for tools in BMTools, the input should be string, while for default langchain toosl, the input is in json format, here we modify the following code + # for tools in swarms.tools, the input should be string, while for default langchain toosl, the input is in json format, here we modify the following code json_args = json.dumps(action.args) observation = tool.run(json_args) except ValidationError as e: diff --git a/swarms/tools/agent/autogptmulti/agent.py b/swarms/tools/agent/autogptmulti/agent.py index 6c44ba44..9f0b9b9e 100644 --- a/swarms/tools/agent/autogptmulti/agent.py +++ b/swarms/tools/agent/autogptmulti/agent.py @@ -112,7 +112,7 @@ class AutoGPT: if action.name in tools: tool = tools[action.name] try: - # for tools in BMTools, the input should be string, while for default langchain toosl, the input is in json format, here we modify the following code + # for tools in swarms.tools, the input should be string, while for default langchain toosl, the input is in json format, here we modify the following code tmp_json = action.args.copy() tmp_json["history context"] = str(history_rec[-5:])[-500:] tmp_json["user message"] = goals[0] diff --git a/swarms/tools/agent/tools_controller.py b/swarms/tools/agent/tools_controller.py index 8b2fb183..ff8188e9 100644 --- a/swarms/tools/agent/tools_controller.py +++ b/swarms/tools/agent/tools_controller.py @@ -6,11 +6,11 @@ import json import os import requests import yaml -from bmtools.agent.apitool import Tool -from bmtools.agent.singletool import STQuestionAnswerer -from bmtools.agent.executor import Executor, AgentExecutorWithTranslation -from bmtools import get_logger -from bmtools.models.customllm import CustomLLM +from swarms.tools.agent.apitool import Tool +from swarms.tools.agent.singletool import STQuestionAnswerer +from swarms.tools.agent.executor import Executor, AgentExecutorWithTranslation +from swarms.tools import get_logger +from swarms.tools.models.customllm import CustomLLM logger = get_logger(__name__) diff --git a/swarms/tools/airbnb/test.py b/swarms/tools/airbnb/test.py index 7ff20c8c..d959f3c7 100644 --- a/swarms/tools/airbnb/test.py +++ b/swarms/tools/airbnb/test.py @@ -1,4 +1,4 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer tool_name, tool_url = 'Airbnb', "http://127.0.0.1:8079/tools/airbnb/" tools_name, tools_config = load_single_tools(tool_name, tool_url) @@ -8,4 +8,4 @@ qa = STQuestionAnswerer() agent = qa.load_tools(tools_name, tools_config) -agent("List some houses to rent in Santa Monica, CA.") \ No newline at end of file +agent("List some houses to rent in Santa Monica, CA.") diff --git a/swarms/tools/arxiv/test.py b/swarms/tools/arxiv/test.py index 40fbdc5e..7ba3c905 100644 --- a/swarms/tools/arxiv/test.py +++ b/swarms/tools/arxiv/test.py @@ -1,4 +1,4 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer tool_name, tool_url = 'arxiv', "http://127.0.0.1:8079/tools/arxiv/" tools_name, tools_config = load_single_tools(tool_name, tool_url) @@ -8,4 +8,4 @@ qa = STQuestionAnswerer() agent = qa.load_tools(tools_name, tools_config) -agent("List some papers written by Timo Schick") \ No newline at end of file +agent("List some papers written by Timo Schick") diff --git a/swarms/tools/database/api.py b/swarms/tools/database/api.py index 42c74ea1..b5ea49cd 100644 --- a/swarms/tools/database/api.py +++ b/swarms/tools/database/api.py @@ -5,8 +5,8 @@ import json import os from ..tool import Tool -from bmtools.tools.database.utils.db_parser import get_conf -from bmtools.tools.database.utils.database import DBArgs, Database +from swarms.tools.database.utils.db_parser import get_conf +from swarms.tools.database.utils.database import DBArgs, Database import openai @@ -151,4 +151,4 @@ def build_database_tool(config) -> Tool: return text_output - return tool \ No newline at end of file + return tool diff --git a/swarms/tools/database/readme.md b/swarms/tools/database/readme.md index d3ea115a..4b837a10 100644 --- a/swarms/tools/database/readme.md +++ b/swarms/tools/database/readme.md @@ -23,7 +23,7 @@ Contributor: [Xuanhe Zhou](https://github.com/zhouxh19) ### Setup -1. Follow the steps in [main readme](https://github.com/OpenBMB/BMTools/blob/main/README.md) +1. Follow the steps in [main readme](https://github.com/OpenBMB/swarms.tools/blob/main/README.md) 2. Rename config.ini.template into my_config.ini diff --git a/swarms/tools/database/test.py b/swarms/tools/database/test.py index 82ba6772..15156d5f 100644 --- a/swarms/tools/database/test.py +++ b/swarms/tools/database/test.py @@ -1,4 +1,4 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer tool_name, tool_url = 'database', "http://127.0.0.1:8079/tools/database/" tool_name, tool_config = load_single_tools(tool_name, tool_url) @@ -145,4 +145,4 @@ Human: Determine which next command to use, and respond using the format specifi } } -''' \ No newline at end of file +''' diff --git a/swarms/tools/db_diag/api.py b/swarms/tools/db_diag/api.py index baf68ad2..f1127a02 100755 --- a/swarms/tools/db_diag/api.py +++ b/swarms/tools/db_diag/api.py @@ -11,14 +11,14 @@ from nltk.tokenize import word_tokenize import nltk from ..tool import Tool -from bmtools.tools.database.utils.db_parser import get_conf -from bmtools.tools.database.utils.database import DBArgs, Database -from bmtools.models.customllm import CustomLLM -from bmtools.knowledge.knowledge_extraction import KnowledgeExtraction -from bmtools.tools.db_diag.anomaly_detection import detect_anomalies -from bmtools.tools.db_diag.anomaly_detection import prometheus +from swarms.tools.tools.database.utils.db_parser import get_conf +from swarms.tools.tools.database.utils.database import DBArgs, Database +from swarms.tools.models.customllm import CustomLLM +from swarms.tools.knowledge.knowledge_extraction import KnowledgeExtraction +from swarms.tools.tools.db_diag.anomaly_detection import detect_anomalies +from swarms.tools.tools.db_diag.anomaly_detection import prometheus -from bmtools.tools.db_diag.example_generate import bm25 +from swarms.tools.tools.db_diag.example_generate import bm25 import warnings @@ -96,7 +96,7 @@ def build_db_diag_tool(config) -> Tool: # "node_sockstat_TCP_tw{instance=\"172.27.58.65:9100\"}", # load knowlege extractor - knowledge_matcher = KnowledgeExtraction("/bmtools/tools/db_diag/root_causes_dbmind.jsonl") + knowledge_matcher = KnowledgeExtraction("/swarms.tools/tools/db_diag/root_causes_dbmind.jsonl") # load db settings script_path = os.path.abspath(__file__) @@ -110,7 +110,7 @@ def build_db_diag_tool(config) -> Tool: server_config = get_conf(script_dir + '/my_config.ini', 'benchserver') monitoring_metrics = [] - with open(str(os.getcwd()) + "/bmtools/tools/db_diag/database_monitoring_metrics", 'r') as f: + with open(str(os.getcwd()) + "/swarms/tools/db_diag/database_monitoring_metrics", 'r') as f: monitoring_metrics = f.read() monitoring_metrics = eval(monitoring_metrics) @@ -312,4 +312,4 @@ Note: include the important slow queries in the output. return {"diagnose": output_analysis, "knowledge": docs_str} - return tool \ No newline at end of file + return tool diff --git a/swarms/tools/db_diag/readme.md b/swarms/tools/db_diag/readme.md index f8118990..366aabc0 100644 --- a/swarms/tools/db_diag/readme.md +++ b/swarms/tools/db_diag/readme.md @@ -11,7 +11,7 @@ Contributor: [Xuanhe Zhou](https://github.com/zhouxh19) ### Setup -1. Follow the steps in [main readme](https://github.com/OpenBMB/BMTools/blob/main/README.md) +1. Follow the steps in [main readme](https://github.com/OpenBMB/swarms.tools/blob/main/README.md) 2. Configure the adopted LLM model in the 84th line of ../../agent/singletool.py, e.g., @@ -21,4 +21,4 @@ Contributor: [Xuanhe Zhou](https://github.com/zhouxh19) 3. Modify the settings in *config.ini*, and rename *config.ini* into *my_config.ini* -4. Modify and run the test.py script to test the tool \ No newline at end of file +4. Modify and run the test.py script to test the tool diff --git a/swarms/tools/db_diag/test.py b/swarms/tools/db_diag/test.py index 6293aebe..2ae8b42e 100644 --- a/swarms/tools/db_diag/test.py +++ b/swarms/tools/db_diag/test.py @@ -1,5 +1,5 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer import datetime tool_name, tool_url = 'db_diag', "http://127.0.0.1:8079/tools/db_diag/" @@ -60,4 +60,4 @@ Note. 1) The first action must be obtain_start_and_end_time_of_anomaly; ''' 1) Action can only be one of the following API names: obtain_start_and_end_time_of_anomaly, whether_is_abnormal_metric, obtain_values_of_metrics, cpu_diagnosis_agent, memory_diagnosis_agent. Any other content in Action is unacceptable; -''' \ No newline at end of file +''' diff --git a/swarms/tools/file_operation/test.py b/swarms/tools/file_operation/test.py index bdbfe7b7..c479ea37 100644 --- a/swarms/tools/file_operation/test.py +++ b/swarms/tools/file_operation/test.py @@ -1,4 +1,4 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer tool_name, tool_url = 'file_operation', "http://127.0.0.1:8079/tools/file_operation/" tool_name, tool_config = load_single_tools(tool_name, tool_url) @@ -6,4 +6,4 @@ print(tool_name, tool_config) stqa = STQuestionAnswerer() agent = stqa.load_tools(tool_name, tool_config) -agent("write hello world to test.txt") \ No newline at end of file +agent("write hello world to test.txt") diff --git a/swarms/tools/film/douban/test.py b/swarms/tools/film/douban/test.py index 5ec2c219..8aaa2b75 100644 --- a/swarms/tools/film/douban/test.py +++ b/swarms/tools/film/douban/test.py @@ -1,5 +1,5 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer tool_name, tool_url = 'douban', "http://127.0.0.1:8079/tools/douban-film/" tools_name, tools_config = load_single_tools(tool_name, tool_url) diff --git a/swarms/tools/google_places/test.py b/swarms/tools/google_places/test.py index 4e3b3bb8..73d8a400 100644 --- a/swarms/tools/google_places/test.py +++ b/swarms/tools/google_places/test.py @@ -1,4 +1,4 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer tool_name, tool_url = 'google_places', "http://127.0.0.1:8079/tools/google_places/" tools_name, tools_config = load_single_tools(tool_name, tool_url) @@ -9,4 +9,4 @@ qa = STQuestionAnswerer() agent = qa.load_tools(tools_name, tools_config) agent("Where is Tsinghua University?") -agent("List a few locations of KFC in Beijing.") \ No newline at end of file +agent("List a few locations of KFC in Beijing.") diff --git a/swarms/tools/google_scholar/test.py b/swarms/tools/google_scholar/test.py index fad47de7..1c157562 100644 --- a/swarms/tools/google_scholar/test.py +++ b/swarms/tools/google_scholar/test.py @@ -1,4 +1,4 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer tool_name, tool_url = 'Google_Scholar', "http://127.0.0.1:8079/tools/google_scholar/" tools_name, tools_config = load_single_tools(tool_name, tool_url) @@ -8,4 +8,4 @@ qa = STQuestionAnswerer() agent = qa.load_tools(tools_name, tools_config) -agent("Search the profile of Jeffery Hinton?") \ No newline at end of file +agent("Search the profile of Jeffery Hinton?") diff --git a/swarms/tools/google_serper/test.py b/swarms/tools/google_serper/test.py index 0409e18c..87ea0e33 100644 --- a/swarms/tools/google_serper/test.py +++ b/swarms/tools/google_serper/test.py @@ -1,4 +1,4 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer tool_name, tool_url = 'google_serper', "http://127.0.0.1:8079/tools/google_serper/" tools_name, tools_config = load_single_tools(tool_name, tool_url) @@ -9,4 +9,4 @@ qa = STQuestionAnswerer() agent = qa.load_tools(tools_name, tools_config) agent("Where was the current US President born?") -agent("List 5 well-known Chinese restaurants in New York and their location.") \ No newline at end of file +agent("List 5 well-known Chinese restaurants in New York and their location.") diff --git a/swarms/tools/gradio_tools/test.py b/swarms/tools/gradio_tools/test.py index 33f765ed..9aa92054 100644 --- a/swarms/tools/gradio_tools/test.py +++ b/swarms/tools/gradio_tools/test.py @@ -1,4 +1,4 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer import pathlib # Langchain tool_name, tool_url = 'gradio_tools', "http://127.0.0.1:8079/tools/gradio_tools/" @@ -21,4 +21,4 @@ agent("Create a video for a panda eating bamboo on a rock.") IMG_PATH = pathlib.Path(__file__).parent / "florida-drivers-license.jpeg" agent(f"Captioning the picture in {IMG_PATH}?The Action in langchain should follow the format:'Action:API's name'.For example,'Action:get_imagecaption.'") # agent(f"Create music from picture in {IMG_PATH}?The Action in langchain should follow the format:'Action:API's name'.For example,'Action:get_imgtomsc.'") -# agent(f"What is the date of birth the driver in {IMG_PATH}?The Action in langchain should follow the format:'Action:API's name'.For example,'Action:get_qa.'") \ No newline at end of file +# agent(f"What is the date of birth the driver in {IMG_PATH}?The Action in langchain should follow the format:'Action:API's name'.For example,'Action:get_qa.'") diff --git a/swarms/tools/hugging_tools/test.py b/swarms/tools/hugging_tools/test.py index 806e3142..f137051d 100644 --- a/swarms/tools/hugging_tools/test.py +++ b/swarms/tools/hugging_tools/test.py @@ -1,5 +1,5 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer tool_name, tool_url = 'hugging_tools', "http://127.0.0.1:8079/tools/hugging_tools/" tools_name, tools_config = load_single_tools(tool_name, tool_url) @@ -94,4 +94,4 @@ agent = qa.load_tools(tools_name, tools_config) # # document-question-answering # answer = agent("Answer the question based on the content of the document screenshot `doc.jpg`: What is the topic of this document?(hint: use the document-question-answering)") -# print(answer) \ No newline at end of file +# print(answer) diff --git a/swarms/tools/image_generation/test.py b/swarms/tools/image_generation/test.py index 43756f2f..5dbad2ac 100644 --- a/swarms/tools/image_generation/test.py +++ b/swarms/tools/image_generation/test.py @@ -1,4 +1,4 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer tool_name, tool_url = 'image_generation', "http://127.0.0.1:8079/tools/image_generation/" tools_name, tools_config = load_single_tools(tool_name, tool_url) @@ -8,4 +8,4 @@ qa = STQuestionAnswerer() agent = qa.load_tools(tools_name, tools_config) -agent("How would you visualize a girl dancing ballet?") \ No newline at end of file +agent("How would you visualize a girl dancing ballet?") diff --git a/swarms/tools/job_search/test.py b/swarms/tools/job_search/test.py index 11469a16..a50f0d65 100644 --- a/swarms/tools/job_search/test.py +++ b/swarms/tools/job_search/test.py @@ -1,4 +1,4 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer tool_name, tool_url = 'JobSearch', "http://127.0.0.1:8079/tools/job_search/" tools_name, tools_config = load_single_tools(tool_name, tool_url) @@ -8,4 +8,4 @@ qa = STQuestionAnswerer() agent = qa.load_tools(tools_name, tools_config) -agent("List some jobs about python development in Santa Monica, CA.") \ No newline at end of file +agent("List some jobs about python development in Santa Monica, CA.") diff --git a/swarms/tools/kg/wikidata/test.py b/swarms/tools/kg/wikidata/test.py index fb1454d5..27dbf3be 100644 --- a/swarms/tools/kg/wikidata/test.py +++ b/swarms/tools/kg/wikidata/test.py @@ -1,5 +1,5 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer tool_name, tool_url = 'wikidata', "http://127.0.0.1:8079/tools/wikidata/" tools_name, tools_config = load_single_tools(tool_name, tool_url) @@ -9,4 +9,4 @@ qa = STQuestionAnswerer() agent = qa.load_tools(tools_name, tools_config) -agent("") \ No newline at end of file +agent("") diff --git a/swarms/tools/map/baidu_map/test_baidu.py b/swarms/tools/map/baidu_map/test_baidu.py index 5be066eb..a1cdebbc 100644 --- a/swarms/tools/map/baidu_map/test_baidu.py +++ b/swarms/tools/map/baidu_map/test_baidu.py @@ -1,4 +1,4 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer tool_name, tool_url = 'Map', "http://127.0.0.1:8079/tools/map/" @@ -156,4 +156,4 @@ if directions: else: print('无法获取路线信息') distance = api.get_distance('北京市海淀区中关村', '北京市朝阳区国贸') -print('北京市海淀区中关村、北京市朝阳区国贸两地距离为:', distance, '米') \ No newline at end of file +print('北京市海淀区中关村、北京市朝阳区国贸两地距离为:', distance, '米') diff --git a/swarms/tools/map/bing_map/test.py b/swarms/tools/map/bing_map/test.py index 691bacb2..0dfb5cbc 100644 --- a/swarms/tools/map/bing_map/test.py +++ b/swarms/tools/map/bing_map/test.py @@ -1,4 +1,4 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer tool_name, tool_url = 'Map', "http://127.0.0.1:8079/tools/map/" tools_name, tools_config = load_single_tools(tool_name, tool_url) @@ -8,4 +8,4 @@ qa = STQuestionAnswerer() agent = qa.load_tools(tools_name, tools_config) -agent("What's the driving distance from Beijing to Shanghai?") \ No newline at end of file +agent("What's the driving distance from Beijing to Shanghai?") diff --git a/swarms/tools/meta_analysis/test.py b/swarms/tools/meta_analysis/test.py index 5dac6b2f..f2a153f1 100644 --- a/swarms/tools/meta_analysis/test.py +++ b/swarms/tools/meta_analysis/test.py @@ -1,5 +1,5 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer tool_name, tool_url = 'meta_analysis', "http://127.0.0.1:8079/tools/meta_analysis/" tools_name, tools_config = load_single_tools(tool_name, tool_url) diff --git a/swarms/tools/python/test.py b/swarms/tools/python/test.py index 2b6f3dd0..32c774b8 100644 --- a/swarms/tools/python/test.py +++ b/swarms/tools/python/test.py @@ -1,4 +1,4 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer tool_name, tool_url = 'python', "http://127.0.0.1:8079/tools/python/" tools_name, tools_config = load_single_tools(tool_name, tool_url) @@ -8,4 +8,4 @@ qa = STQuestionAnswerer() agent = qa.load_tools(tools_name, tools_config) -agent("What is the 10th fibonacci number?") \ No newline at end of file +agent("What is the 10th fibonacci number?") diff --git a/swarms/tools/sceneXplain/test.py b/swarms/tools/sceneXplain/test.py index 8e2af071..4a5a5570 100644 --- a/swarms/tools/sceneXplain/test.py +++ b/swarms/tools/sceneXplain/test.py @@ -1,4 +1,4 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer tool_name, tool_url = 'sceneXplain', "http://127.0.0.1:8079/tools/sceneXplain/" tools_name, tools_config = load_single_tools(tool_name, tool_url) @@ -9,4 +9,4 @@ qa = STQuestionAnswerer() agent = qa.load_tools(tools_name, tools_config) agent("What is in this image https://storage.googleapis.com/causal-diffusion.appspot.com/imagePrompts%2F0rw369i5h9t%2Foriginal.png?") -agent("Describe Van Gogh's painting The Starry Night.") \ No newline at end of file +agent("Describe Van Gogh's painting The Starry Night.") diff --git a/swarms/tools/shell/test.py b/swarms/tools/shell/test.py index 45d74b27..3bd499aa 100644 --- a/swarms/tools/shell/test.py +++ b/swarms/tools/shell/test.py @@ -1,4 +1,4 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer tool_name, tool_url = 'shell', "http://127.0.0.1:8079/tools/shell/" tools_name, tools_config = load_single_tools(tool_name, tool_url) @@ -8,4 +8,4 @@ qa = STQuestionAnswerer() agent = qa.load_tools(tools_name, tools_config) -agent("print 'Hello World!'") \ No newline at end of file +agent("print 'Hello World!'") diff --git a/swarms/tools/stock/test.py b/swarms/tools/stock/test.py index 0164b59c..5e910903 100644 --- a/swarms/tools/stock/test.py +++ b/swarms/tools/stock/test.py @@ -1,4 +1,4 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer tool_name, tool_url = 'Stock', "http://127.0.0.1:8079/tools/stock/" tools_name, tools_config = load_single_tools(tool_name, tool_url) @@ -8,4 +8,4 @@ qa = STQuestionAnswerer() agent = qa.load_tools(tools_name, tools_config) -agent("What's the close price of Apple stock at 2022/02/21?") \ No newline at end of file +agent("What's the close price of Apple stock at 2022/02/21?") diff --git a/swarms/tools/translation/baidu/test.py b/swarms/tools/translation/baidu/test.py index 6b7120f6..37ce3ee2 100644 --- a/swarms/tools/translation/baidu/test.py +++ b/swarms/tools/translation/baidu/test.py @@ -1,5 +1,5 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer tool_name, tool_url = 'baidu-translation', "http://127.0.0.1:8079/tools/baidu-translation/" tools_name, tools_config = load_single_tools(tool_name, tool_url) @@ -10,4 +10,4 @@ print(tools_config) agent = qa.load_tools(tools_name, tools_config) answer = agent("Translate this sentence into Chinese(zh): Hello, world!") -print(answer) \ No newline at end of file +print(answer) diff --git a/swarms/tools/translation/nllb/test.py b/swarms/tools/translation/nllb/test.py index fed6f5d6..bb3cf87e 100644 --- a/swarms/tools/translation/nllb/test.py +++ b/swarms/tools/translation/nllb/test.py @@ -1,5 +1,5 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer tool_name, tool_url = 'nllb-translation', "http://127.0.0.1:8079/tools/nllb-translation/" tools_name, tools_config = load_single_tools(tool_name, tool_url) @@ -10,4 +10,4 @@ print(tools_config) agent = qa.load_tools(tools_name, tools_config) answer = agent("Translate this sentence into Chinese(zho_Hans): Hello, world!") -print(answer) \ No newline at end of file +print(answer) diff --git a/swarms/tools/travel/test.py b/swarms/tools/travel/test.py index 233059e8..c774c713 100644 --- a/swarms/tools/travel/test.py +++ b/swarms/tools/travel/test.py @@ -1,4 +1,4 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer from datetime import datetime, timedelta tool_name, tool_url = 'travel', "http://127.0.0.1:8079/tools/travel/" @@ -12,4 +12,4 @@ agent = qa.load_tools(tools_name, tools_config) month_later = str(datetime.now() + timedelta(days=30)).split()[0] agent(f"I will go to Seattle from Beijing on {month_later}. Can you make a recommendation on hotels and flight please?") agent("Please help me rent a car near Tsinghua University.") -agent("Where can I visit on weekend if I am going to University of Washington this summer?") \ No newline at end of file +agent("Where can I visit on weekend if I am going to University of Washington this summer?") diff --git a/swarms/tools/tutorial/test.py b/swarms/tools/tutorial/test.py index 6628639f..a6ae9f86 100644 --- a/swarms/tools/tutorial/test.py +++ b/swarms/tools/tutorial/test.py @@ -1,5 +1,5 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer tool_name, tool_url = 'tutorial', "http://127.0.0.1:8079/tools/tutorial/" tools_name, tools_config = load_single_tools(tool_name, tool_url) @@ -10,4 +10,4 @@ print(tools_config) agent = qa.load_tools(tools_name, tools_config) answer = agent("I want to cook pizza.") -print(answer) \ No newline at end of file +print(answer) diff --git a/swarms/tools/walmart/test.py b/swarms/tools/walmart/test.py index de0123e2..d35eb959 100644 --- a/swarms/tools/walmart/test.py +++ b/swarms/tools/walmart/test.py @@ -1,4 +1,4 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer tool_name, tool_url = 'walmart', "http://127.0.0.1:8079/tools/walmart/" tools_name, tools_config = load_single_tools(tool_name, tool_url) diff --git a/swarms/tools/weather/test.py b/swarms/tools/weather/test.py index 07cdbf3a..ea2140c9 100644 --- a/swarms/tools/weather/test.py +++ b/swarms/tools/weather/test.py @@ -1,4 +1,4 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer tool_name, tool_url = 'weather', "http://127.0.0.1:8079/tools/weather/" tools_name, tools_config = load_single_tools(tool_name, tool_url) @@ -8,4 +8,4 @@ qa = STQuestionAnswerer() agent = qa.load_tools(tools_name, tools_config) -agent("What's the weather in London today?") \ No newline at end of file +agent("What's the weather in London today?") diff --git a/swarms/tools/wikipedia/test.py b/swarms/tools/wikipedia/test.py index 531bc5bd..60d7fd7d 100644 --- a/swarms/tools/wikipedia/test.py +++ b/swarms/tools/wikipedia/test.py @@ -1,5 +1,5 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer import requests import json @@ -19,4 +19,4 @@ agent = qa.load_tools(tools_name, tools_config) agent("Which magazine was started first, Arthur’s Magazine or First for Women?") -agent("when was the first hunger games book published?") \ No newline at end of file +agent("when was the first hunger games book published?") diff --git a/swarms/tools/wolframalpha/test.py b/swarms/tools/wolframalpha/test.py index a22270a5..4b9049aa 100644 --- a/swarms/tools/wolframalpha/test.py +++ b/swarms/tools/wolframalpha/test.py @@ -1,5 +1,5 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer tool_name, tool_url = 'wolframalpha', "http://127.0.0.1:8079/tools/wolframalpha/" tools_name, tools_config = load_single_tools(tool_name, tool_url) @@ -9,4 +9,4 @@ qa = STQuestionAnswerer() agent = qa.load_tools(tools_name, tools_config) -agent("Calc integral of sin(x)+2x^2+3x+1 from 0 to 1") \ No newline at end of file +agent("Calc integral of sin(x)+2x^2+3x+1 from 0 to 1") diff --git a/swarms/tools/zillow/test.py b/swarms/tools/zillow/test.py index 21c43c33..5375311b 100644 --- a/swarms/tools/zillow/test.py +++ b/swarms/tools/zillow/test.py @@ -1,4 +1,4 @@ -from bmtools.agent.singletool import load_single_tools, STQuestionAnswerer +from swarms.tools.agent.singletool import load_single_tools, STQuestionAnswerer tool_name, tool_url = 'Zillow', "http://127.0.0.1:8079/tools/zillow/" tools_name, tools_config = load_single_tools(tool_name, tool_url) @@ -8,4 +8,4 @@ qa = STQuestionAnswerer() agent = qa.load_tools(tools_name, tools_config) -agent("List some houses in Santa Monica, CA.") \ No newline at end of file +agent("List some houses in Santa Monica, CA.") diff --git a/swarms/utils/tool_logging.py b/swarms/utils/tool_logging.py index 47145dd0..fea55df1 100644 --- a/swarms/utils/tool_logging.py +++ b/swarms/utils/tool_logging.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# BMTools copied from Huggingface Transformers +# swarms.tools copied from Huggingface Transformers """ Logging utilities.""" import logging @@ -47,16 +47,16 @@ _default_log_level = logging.INFO def _get_default_logging_level(): """ - If BMTOOLS_VERBOSITY env var is set to one of the valid choices return that as the new default level. If it is + If SWARMSTOOLS_VERBOSITY env var is set to one of the valid choices return that as the new default level. If it is not - fall back to ``_default_log_level`` """ - env_level_str = os.getenv("BMTOOLS_VERBOSITY", None) + env_level_str = os.getenv("SWARMSTOOLS_VERBOSITY", None) if env_level_str: if env_level_str in log_levels: return log_levels[env_level_str] else: logging.getLogger().warning( - f"Unknown option BMTOOLS_VERBOSITY={env_level_str}, " + f"Unknown option SWARMSTOOLS_VERBOSITY={env_level_str}, " f"has to be one of: { ', '.join(log_levels.keys()) }" ) return _default_log_level @@ -83,7 +83,7 @@ def _configure_library_root_logger() -> None: _default_handler = logging.StreamHandler() # Set sys.stderr as stream. _default_handler.flush = sys.stderr.flush formatter = logging.Formatter( - "\033[1;31m[%(levelname)s|(BMTools)%(module)s:%(lineno)d]%(asctime)s >> \033[0m %(message)s") + "\033[1;31m[%(levelname)s|(SWARMSTools)%(module)s:%(lineno)d]%(asctime)s >> \033[0m %(message)s") _default_handler.setFormatter(formatter) # Apply our default configuration to the library root logger. @@ -278,8 +278,8 @@ def get_logger(name: Optional[str] = None, verbosity='info') -> logging.Logger: logger.setLevel(log_levels[verbosity]) # Set up a file handler to write log messages to a file - # file_handler = logging.FileHandler('/Users/xuanhe/Documents/our-paper/instructdb/code/BMTools/bmtools/tools/database/my_log_file.log') + # file_handler = logging.FileHandler('/Users/xuanhe/Documents/our-paper/instructdb/code/BMTools/swarms.tools/tools/database/my_log_file.log') # file_handler.setLevel(log_levels[verbosity]) # logger.addHandler(file_handler) - return logger \ No newline at end of file + return logger