diff --git a/tests/tools/test_image_gen.py b/tests/tools/test_image_gen.py index 1f9bdf730..3f343190c 100644 --- a/tests/tools/test_image_gen.py +++ b/tests/tools/test_image_gen.py @@ -1,5 +1,5 @@ from modelscope_agent.agent import Agent -from modelscope_agent.tools.image_generation import TextToImageTool +from modelscope_agent.tools import TextToImageTool from modelscope_agent.agents.role_play import RolePlay # NOQA diff --git a/tests/tools/test_local_tools.py b/tests/tools/test_local_tools.py index 372cc3e06..484b7d911 100644 --- a/tests/tools/test_local_tools.py +++ b/tests/tools/test_local_tools.py @@ -1,4 +1,4 @@ -from modelscope_agent.tools import ModelscopePipelineTool, Tool +from modelscope_agent.tools import ModelscopePipelineTool def test_modelscope_pipline(): diff --git a/tests/tools/test_modelscope_tools.py b/tests/tools/test_modelscope_tools.py index bb035661a..6afc243d1 100644 --- a/tests/tools/test_modelscope_tools.py +++ b/tests/tools/test_modelscope_tools.py @@ -4,7 +4,7 @@ def test_modelscope_speech_generation(): - from modelscope_agent.tools.text_to_speech_tool import TexttoSpeechTool + from modelscope_agent.tools import TexttoSpeechTool input = '北京今天天气怎样?' kwargs = {'input': input, 'gender': 'man'} txt2speech = TexttoSpeechTool(cfg) @@ -17,7 +17,7 @@ def test_modelscope_speech_generation(): def test_modelscope_text_address(): - from modelscope_agent.tools.text_address_tool import TextAddressTool + from modelscope_agent.tools import TextAddressTool input = '北京朝阳望京东金辉大厦' kwargs = {'input': input} txt_addr = TextAddressTool(cfg) @@ -27,7 +27,7 @@ def test_modelscope_text_address(): def test_modelscope_text_ner(): - from modelscope_agent.tools.text_ner_tool import TextNerTool + from modelscope_agent.tools import TextNerTool input = '北京今天天气怎样?' kwargs = {'input': input} txt_ner = TextNerTool(cfg) @@ -37,7 +37,7 @@ def test_modelscope_text_ner(): def test_modelscope_video_generation(): - from modelscope_agent.tools.text_to_video_tool import TextToVideoTool + from modelscope_agent.tools import TextToVideoTool input = '一个正在打篮球的人' kwargs = {'text': input} video_gen = TextToVideoTool(cfg) @@ -47,7 +47,7 @@ def test_modelscope_video_generation(): def test_modelscope_zh2en(): - from modelscope_agent.tools.translation_zh2en_tool import TranslationZh2EnTool + from modelscope_agent.tools import TranslationZh2EnTool input = '北京今天天气怎样?' kwargs = {'input': input} zh_to_en = TranslationZh2EnTool(cfg) @@ -57,7 +57,7 @@ def test_modelscope_zh2en(): def test_modelscope_en2zh(): - from modelscope_agent.tools.translation_en2zh_tool import TranslationEn2ZhTool + from modelscope_agent.tools import TranslationEn2ZhTool input = 'Autonomous agents have long been a prominent research focus in both academic and industry communities.' kwargs = {'input': input} en_to_zh = TranslationEn2ZhTool(cfg) diff --git a/tests/tools/test_pipeline_tool.py b/tests/tools/test_pipeline_tool.py index f51054507..01175bc23 100644 --- a/tests/tools/test_pipeline_tool.py +++ b/tests/tools/test_pipeline_tool.py @@ -1,13 +1,16 @@ -from modelscope_agent.tools.pipeline_tool import ModelscopePipelineTool -from modelscope.utils.config import Config import os +from modelscope_agent.tools import ModelscopePipelineTool + +from modelscope.utils.config import Config + cfg = Config.from_file('config/cfg_tool_template.json') # 请用自己的SDK令牌替换{YOUR_MODELSCOPE_SDK_TOKEN}(包括大括号) -os.environ['MODELSCOPE_API_KEY'] = f"{YOUR_MODELSCOPE_SDK_TOKEN}" +os.environ['MODELSCOPE_API_KEY'] = f'{YOUR_MODELSCOPE_SDK_TOKEN}' + def test_modelscope_speech_generation(): - from modelscope_agent.tools.text_to_speech_tool import TexttoSpeechTool + from modelscope_agent.tools import TexttoSpeechTool kwargs = """{'input': '北京今天天气怎样?', 'gender': 'man'}""" txt2speech = TexttoSpeechTool(cfg) res = txt2speech.call(kwargs) @@ -15,4 +18,3 @@ def test_modelscope_speech_generation(): test_modelscope_speech_generation() - diff --git a/tests/tools/test_style_repaint.py b/tests/tools/test_style_repaint.py index 65f7802f9..fa61e5eda 100644 --- a/tests/tools/test_style_repaint.py +++ b/tests/tools/test_style_repaint.py @@ -1,9 +1,4 @@ -import os - -from modelscope_agent.agent import Agent -from modelscope_agent.tools.style_repaint import StyleRepaint - -print(os.getcwd()) +from modelscope_agent.tools import StyleRepaint from modelscope_agent.agents.role_play import RolePlay # NOQA