From f60d4c2bb1f57140ac9b6edf61f71760bff9320d Mon Sep 17 00:00:00 2001 From: cmgzn <85746275+cmgzn@users.noreply.github.com> Date: Tue, 5 Nov 2024 15:13:12 +0800 Subject: [PATCH] Update dashscope version requirement (#477) --- setup.py | 2 +- src/agentscope/models/dashscope_model.py | 10 +++++++++- .../service/multi_modality/dashscope_services.py | 2 +- src/agentscope/web/gradio/utils.py | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 75c1077d3..e72e5ea6b 100644 --- a/setup.py +++ b/setup.py @@ -38,7 +38,7 @@ "scipy", # Leaving openai and dashscope here as default supports "openai>=1.3.0", - "dashscope==1.14.1", + "dashscope>=1.19.0", ] extra_service_requires = [ diff --git a/src/agentscope/models/dashscope_model.py b/src/agentscope/models/dashscope_model.py index a3ac23613..02412e4df 100644 --- a/src/agentscope/models/dashscope_model.py +++ b/src/agentscope/models/dashscope_model.py @@ -13,6 +13,14 @@ try: import dashscope + + dashscope_version = dashscope.version.__version__ + if dashscope_version < "1.19.0": + logger.warning( + f"You are using 'dashscope' version {dashscope_version}, " + "which is below the recommended version 1.19.0. " + "Please consider upgrading to maintain compatibility.", + ) from dashscope.api_entities.dashscope_response import GenerationResponse except ImportError: dashscope = None @@ -54,7 +62,7 @@ def __init__( if dashscope is None: raise ImportError( "The package 'dashscope' is not installed. Please install it " - "by running `pip install dashscope==1.14.1`", + "by running `pip install dashscope>=1.19.0`", ) self.generate_args = generate_args or {} diff --git a/src/agentscope/service/multi_modality/dashscope_services.py b/src/agentscope/service/multi_modality/dashscope_services.py index d372b597e..5d2e288b6 100644 --- a/src/agentscope/service/multi_modality/dashscope_services.py +++ b/src/agentscope/service/multi_modality/dashscope_services.py @@ -258,7 +258,7 @@ def dashscope_text_to_audio( except ImportError as e: raise ImportError( "The package 'dashscope' is not installed. Please install it by " - "running `pip install dashscope==1.14.1`", + "running `pip install dashscope>=1.19.0`", ) from e dashscope.api_key = api_key diff --git a/src/agentscope/web/gradio/utils.py b/src/agentscope/web/gradio/utils.py index 4b7285e65..36b3a810e 100644 --- a/src/agentscope/web/gradio/utils.py +++ b/src/agentscope/web/gradio/utils.py @@ -174,7 +174,7 @@ def audio2text(audio_path: str) -> str: except ImportError as e: raise ImportError( "The package dashscope is not found. Please install it by " - "running `pip install dashscope==1.14.1`", + "running `pip install dashscope>=1.19.0`", ) from e callback = RecognitionCallback()