dashscope 1.24.5__py3-none-any.whl → 1.24.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of dashscope might be problematic. Click here for more details.

@@ -138,8 +138,15 @@ class ImageSynthesis(BaseAsyncApi):
138
138
  has_upload = False
139
139
  if negative_prompt is not None:
140
140
  inputs[NEGATIVE_PROMPT] = negative_prompt
141
- if images is not None:
142
- inputs[IMAGES] = images
141
+ if images is not None and images and len(images) > 0:
142
+ new_images = []
143
+ for image in images:
144
+ is_upload, new_image = check_and_upload_local(
145
+ model, image, api_key)
146
+ if is_upload:
147
+ has_upload = True
148
+ new_images.append(new_image)
149
+ inputs[IMAGES] = new_images
143
150
  if sketch_image_url is not None and sketch_image_url:
144
151
  is_upload, sketch_image_url = check_and_upload_local(
145
152
  model, sketch_image_url, api_key)
@@ -178,10 +185,20 @@ class ImageSynthesis(BaseAsyncApi):
178
185
  headers['X-DashScope-OssResourceResolve'] = 'enable'
179
186
  kwargs['headers'] = headers
180
187
 
181
- if task is None:
182
- task = ImageSynthesis.task
183
- if model is not None and model and 'imageedit' in model:
184
- task = 'image2image'
188
+ def __get_i2i_task(task, model) -> str:
189
+ # 处理task参数:优先使用有效的task值
190
+ if task is not None and task != "":
191
+ return task
192
+
193
+ # 根据model确定任务类型
194
+ if model is not None and model != "":
195
+ if 'imageedit' in model or "wan2.5-i2i" in model:
196
+ return 'image2image'
197
+
198
+ # 默认返回文本到图像任务
199
+ return ImageSynthesis.task
200
+
201
+ task = __get_i2i_task(task, model)
185
202
 
186
203
  return inputs, kwargs, task
187
204
 
@@ -28,6 +28,8 @@ class MultiModalConversation(BaseApi):
28
28
  api_key: str = None,
29
29
  workspace: str = None,
30
30
  text: str = None,
31
+ voice: str = None,
32
+ language_type: str = None,
31
33
  **kwargs
32
34
  ) -> Union[MultiModalConversationResponse, Generator[
33
35
  MultiModalConversationResponse, None, None]]:
@@ -57,6 +59,9 @@ class MultiModalConversation(BaseApi):
57
59
  [1]: https://help.aliyun.com/zh/dashscope/developer-reference/api-key-settings. # noqa E501
58
60
  workspace (str): The dashscope workspace id.
59
61
  text (str): The text to generate.
62
+ voice (str): The voice name of qwen tts, include 'Cherry'/'Ethan'/'Sunny'/'Dylan' and so on,
63
+ you can get the total voice list : https://help.aliyun.com/zh/model-studio/qwen-tts.
64
+ language_type (str): The synthesized language type, default is 'auto', useful for [qwen3-tts].
60
65
  **kwargs:
61
66
  stream(bool, `optional`): Enable server-sent events
62
67
  (ref: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events) # noqa E501
@@ -70,8 +75,6 @@ class MultiModalConversation(BaseApi):
70
75
  tokens with top_p probability mass. So 0.1 means only
71
76
  the tokens comprising the top 10% probability mass are
72
77
  considered[qwen-turbo,bailian-v1].
73
- voice(string, `optional`): The voice name of qwen tts, include 'Cherry'/'Ethan'/'Sunny'/'Dylan' and so on,
74
- you can get the total voice list : https://help.aliyun.com/zh/model-studio/qwen-tts.
75
78
  top_k(float, `optional`):
76
79
 
77
80
 
@@ -99,6 +102,10 @@ class MultiModalConversation(BaseApi):
99
102
 
100
103
  if text is not None and text:
101
104
  input.update({'text': text})
105
+ if voice is not None and voice:
106
+ input.update({'voice': voice})
107
+ if language_type is not None and language_type:
108
+ input.update({'language_type': language_type})
102
109
  if msg_copy is not None:
103
110
  input.update({'messages': msg_copy})
104
111
  response = super().call(model=model,
@@ -160,6 +167,8 @@ class AioMultiModalConversation(BaseAioApi):
160
167
  api_key: str = None,
161
168
  workspace: str = None,
162
169
  text: str = None,
170
+ voice: str = None,
171
+ language_type: str = None,
163
172
  **kwargs
164
173
  ) -> Union[MultiModalConversationResponse, Generator[
165
174
  MultiModalConversationResponse, None, None]]:
@@ -189,6 +198,9 @@ class AioMultiModalConversation(BaseAioApi):
189
198
  [1]: https://help.aliyun.com/zh/dashscope/developer-reference/api-key-settings. # noqa E501
190
199
  workspace (str): The dashscope workspace id.
191
200
  text (str): The text to generate.
201
+ voice (str): The voice name of qwen tts, include 'Cherry'/'Ethan'/'Sunny'/'Dylan' and so on,
202
+ you can get the total voice list : https://help.aliyun.com/zh/model-studio/qwen-tts.
203
+ language_type (str): The synthesized language type, default is 'auto', useful for [qwen3-tts].
192
204
  **kwargs:
193
205
  stream(bool, `optional`): Enable server-sent events
194
206
  (ref: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events) # noqa E501
@@ -202,8 +214,6 @@ class AioMultiModalConversation(BaseAioApi):
202
214
  tokens with top_p probability mass. So 0.1 means only
203
215
  the tokens comprising the top 10% probability mass are
204
216
  considered[qwen-turbo,bailian-v1].
205
- voice(string, `optional`): The voice name of qwen tts, include 'Cherry'/'Ethan'/'Sunny'/'Dylan' and so on,
206
- you can get the total voice list : https://help.aliyun.com/zh/model-studio/qwen-tts.
207
217
  top_k(float, `optional`):
208
218
 
209
219
  Raises:
@@ -230,6 +240,10 @@ class AioMultiModalConversation(BaseAioApi):
230
240
 
231
241
  if text is not None and text:
232
242
  input.update({'text': text})
243
+ if voice is not None and voice:
244
+ input.update({'voice': voice})
245
+ if language_type is not None and language_type:
246
+ input.update({'language_type': language_type})
233
247
  if msg_copy is not None:
234
248
  input.update({'messages': msg_copy})
235
249
  response = await super().call(model=model,
@@ -38,6 +38,7 @@ class VideoSynthesis(BaseAsyncApi):
38
38
  negative_prompt: str = None,
39
39
  template: str = None,
40
40
  img_url: str = None,
41
+ audio_url: str = None,
41
42
  api_key: str = None,
42
43
  extra_input: Dict = None,
43
44
  workspace: str = None,
@@ -56,6 +57,7 @@ class VideoSynthesis(BaseAsyncApi):
56
57
  negative_prompt (str): The negative prompt is the opposite of the prompt meaning.
57
58
  template (str): LoRa input, such as gufeng, katong, etc.
58
59
  img_url (str): The input image url, Generate the URL of the image referenced by the video.
60
+ audio_url (str): The input audio url
59
61
  api_key (str, optional): The api api_key. Defaults to None.
60
62
  workspace (str): The dashscope workspace id.
61
63
  extra_input (Dict): The extra input parameters.
@@ -76,6 +78,7 @@ class VideoSynthesis(BaseAsyncApi):
76
78
  return super().call(model,
77
79
  prompt,
78
80
  img_url=img_url,
81
+ audio_url=audio_url,
79
82
  api_key=api_key,
80
83
  extend_prompt=extend_prompt,
81
84
  negative_prompt=negative_prompt,
@@ -94,6 +97,7 @@ class VideoSynthesis(BaseAsyncApi):
94
97
  model: str,
95
98
  prompt: Any = None,
96
99
  img_url: str = None,
100
+ audio_url: str = None,
97
101
  # """@deprecated, use prompt_extend in parameters """
98
102
  extend_prompt: bool = True,
99
103
  negative_prompt: str = None,
@@ -125,6 +129,13 @@ class VideoSynthesis(BaseAsyncApi):
125
129
  has_upload = True
126
130
  inputs['img_url'] = res_img_url
127
131
 
132
+ if audio_url is not None and audio_url:
133
+ is_upload, res_audio_url = check_and_upload_local(
134
+ model, audio_url, api_key)
135
+ if is_upload:
136
+ has_upload = True
137
+ inputs['audio_url'] = res_audio_url
138
+
128
139
  if head_frame is not None and head_frame:
129
140
  is_upload, res_head_frame = check_and_upload_local(
130
141
  model, head_frame, api_key)
@@ -172,6 +183,7 @@ class VideoSynthesis(BaseAsyncApi):
172
183
  model: str,
173
184
  prompt: Any = None,
174
185
  img_url: str = None,
186
+ audio_url: str = None,
175
187
  # """@deprecated, use prompt_extend in parameters """
176
188
  extend_prompt: bool = True,
177
189
  negative_prompt: str = None,
@@ -194,6 +206,7 @@ class VideoSynthesis(BaseAsyncApi):
194
206
  negative_prompt (str): The negative prompt is the opposite of the prompt meaning.
195
207
  template (str): LoRa input, such as gufeng, katong, etc.
196
208
  img_url (str): The input image url, Generate the URL of the image referenced by the video.
209
+ audio_url (str): The input audio url.
197
210
  api_key (str, optional): The api api_key. Defaults to None.
198
211
  workspace (str): The dashscope workspace id.
199
212
  extra_input (Dict): The extra input parameters.
@@ -215,7 +228,7 @@ class VideoSynthesis(BaseAsyncApi):
215
228
  task_group, function = _get_task_group_and_task(__name__)
216
229
 
217
230
  inputs, kwargs, task = cls._get_input(
218
- model, prompt, img_url, extend_prompt, negative_prompt, template, api_key,
231
+ model, prompt, img_url, audio_url, extend_prompt, negative_prompt, template, api_key,
219
232
  extra_input, task, function, head_frame, tail_frame,
220
233
  first_frame_url, last_frame_url, **kwargs)
221
234
 
@@ -339,6 +352,7 @@ class AioVideoSynthesis(BaseAsyncAioApi):
339
352
  model: str,
340
353
  prompt: Any = None,
341
354
  img_url: str = None,
355
+ audio_url: str = None,
342
356
  # """@deprecated, use prompt_extend in parameters """
343
357
  extend_prompt: bool = True,
344
358
  negative_prompt: str = None,
@@ -361,6 +375,7 @@ class AioVideoSynthesis(BaseAsyncAioApi):
361
375
  negative_prompt (str): The negative prompt is the opposite of the prompt meaning.
362
376
  template (str): LoRa input, such as gufeng, katong, etc.
363
377
  img_url (str): The input image url, Generate the URL of the image referenced by the video.
378
+ audio_url (str): The input audio url.
364
379
  api_key (str, optional): The api api_key. Defaults to None.
365
380
  workspace (str): The dashscope workspace id.
366
381
  extra_input (Dict): The extra input parameters.
@@ -380,7 +395,7 @@ class AioVideoSynthesis(BaseAsyncAioApi):
380
395
  """
381
396
  task_group, f = _get_task_group_and_task(__name__)
382
397
  inputs, kwargs, task = VideoSynthesis._get_input(
383
- model, prompt, img_url, extend_prompt, negative_prompt, template, api_key,
398
+ model, prompt, img_url, audio_url, extend_prompt, negative_prompt, template, api_key,
384
399
  extra_input, task, f, head_frame, tail_frame,
385
400
  first_frame_url, last_frame_url, **kwargs)
386
401
  response = await super().call(model, inputs, task_group, task, f, api_key, workspace, **kwargs)
@@ -391,6 +406,7 @@ class AioVideoSynthesis(BaseAsyncAioApi):
391
406
  model: str,
392
407
  prompt: Any = None,
393
408
  img_url: str = None,
409
+ audio_url: str = None,
394
410
  # """@deprecated, use prompt_extend in parameters """
395
411
  extend_prompt: bool = True,
396
412
  negative_prompt: str = None,
@@ -413,6 +429,7 @@ class AioVideoSynthesis(BaseAsyncAioApi):
413
429
  negative_prompt (str): The negative prompt is the opposite of the prompt meaning.
414
430
  template (str): LoRa input, such as gufeng, katong, etc.
415
431
  img_url (str): The input image url, Generate the URL of the image referenced by the video.
432
+ audio_url (str): The input audio url.
416
433
  api_key (str, optional): The api api_key. Defaults to None.
417
434
  workspace (str): The dashscope workspace id.
418
435
  extra_input (Dict): The extra input parameters.
@@ -434,7 +451,7 @@ class AioVideoSynthesis(BaseAsyncAioApi):
434
451
  task_group, function = _get_task_group_and_task(__name__)
435
452
 
436
453
  inputs, kwargs, task = VideoSynthesis._get_input(
437
- model, prompt, img_url, extend_prompt, negative_prompt, template, api_key,
454
+ model, prompt, img_url, audio_url, extend_prompt, negative_prompt, template, api_key,
438
455
  extra_input, task, function, head_frame, tail_frame,
439
456
  first_frame_url, last_frame_url, **kwargs)
440
457
 
@@ -196,4 +196,8 @@ class Application(BaseApi):
196
196
  if image_list is not None and image_list:
197
197
  input_param['image_list'] = image_list
198
198
 
199
+ file_list = kwargs.pop('file_list', None)
200
+ if file_list is not None and file_list:
201
+ input_param['file_list'] = file_list
202
+
199
203
  return input_param, {**parameters, **kwargs}
@@ -158,6 +158,7 @@ class QwenTtsRealtime:
158
158
  response_format: AudioFormat = AudioFormat.
159
159
  PCM_24000HZ_MONO_16BIT,
160
160
  mode: str = 'server_commit',
161
+ language_type: str = None,
161
162
  **kwargs) -> None:
162
163
  '''
163
164
  update session configuration, should be used before create response
@@ -170,6 +171,8 @@ class QwenTtsRealtime:
170
171
  output audio format
171
172
  mode: str
172
173
  response mode, server_commit or commit
174
+ language_type: str
175
+ language type for synthesized audio, default is 'auto'
173
176
  '''
174
177
  self.config = {
175
178
  'voice': voice,
@@ -177,6 +180,8 @@ class QwenTtsRealtime:
177
180
  'response_format': response_format.format,
178
181
  'sample_rate': response_format.sample_rate,
179
182
  }
183
+ if language_type is not None:
184
+ self.config['language_type'] = language_type
180
185
  self.config.update(kwargs)
181
186
  self.__send_str(
182
187
  json.dumps({
dashscope/version.py CHANGED
@@ -1,3 +1,3 @@
1
1
  # Copyright (c) Alibaba, Inc. and its affiliates.
2
2
 
3
- __version__ = '1.24.5'
3
+ __version__ = '1.24.7'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dashscope
3
- Version: 1.24.5
3
+ Version: 1.24.7
4
4
  Summary: dashscope client sdk library
5
5
  Home-page: https://dashscope.aliyun.com/
6
6
  Author: Alibaba Cloud
@@ -3,15 +3,15 @@ dashscope/cli.py,sha256=64oGkevgX0RHPPmMg0sevXDgaFLQNA_0vdtjQ7Z2pHM,26492
3
3
  dashscope/files.py,sha256=vRDQygm3lOqBZR73o7KNHs1iTBVuvLncuwJNxIYjzAU,3981
4
4
  dashscope/model.py,sha256=B5v_BtYLPqj6raClejBgdKg6WTGwhH_f-20pvsQqmsk,1491
5
5
  dashscope/models.py,sha256=dE4mzXkl85G343qVylSGpURPRdA5pZSqXlx6PcxqC_Q,1275
6
- dashscope/version.py,sha256=2fvqw7bZLyWOIDvUb8DEkdi6y_VgyljhOeYdITEksWM,74
6
+ dashscope/version.py,sha256=bwLuOw_5t9V66aTp9e4fg40jaUHqhx-IXawXHN8THGg,74
7
7
  dashscope/aigc/__init__.py,sha256=kYvYEoRK-NUHyMWpBDNQBz4fVA__uOhHRK2kDTBaWgk,617
8
8
  dashscope/aigc/chat_completion.py,sha256=ONlyyssIbfaKKcFo7cEKhHx5OCF2XX810HFzIExW1ho,14813
9
9
  dashscope/aigc/code_generation.py,sha256=p_mxDKJLQMW0IjFD46JRlZuEZCRESSVKEfLlAevBtqw,10936
10
10
  dashscope/aigc/conversation.py,sha256=95xEEY4ThZJysj5zy3aMw7ql9KLJVfD_1iHv9QZ17Ew,14282
11
11
  dashscope/aigc/generation.py,sha256=xMcMu16rICTdjZiD_sPqYV_Ltdp4ewGzzfC7JD9VApY,17948
12
- dashscope/aigc/image_synthesis.py,sha256=Itx9h5brEwC-d3Mj_ntDHGd4qaitqDg9DeGHMJouhMk,28178
13
- dashscope/aigc/multimodal_conversation.py,sha256=BXpUthyGxJHQs18-m_ZzAw6MI5nSM4_NVMUfTDSC1-k,11682
14
- dashscope/aigc/video_synthesis.py,sha256=RSPjar5-YiF9xclRmf9H7-5QbRxLcsNXO4zS7oTKi2I,24137
12
+ dashscope/aigc/image_synthesis.py,sha256=sKKKmc11nwNSBEuhLb6ymUr5pxVAAl87uB-ALuh0dLE,28851
13
+ dashscope/aigc/multimodal_conversation.py,sha256=k-OPWwgrWJBb7LiUdFuuP9X6sR5ukbaRHPqFTSikO7Y,12380
14
+ dashscope/aigc/video_synthesis.py,sha256=Wps8ZE3rDRFoebh7w1uvLNSyKHKk1BCTXmq7ryG9iPQ,24885
15
15
  dashscope/api_entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  dashscope/api_entities/aiohttp_request.py,sha256=1L7XdIJ9L65cQmX8x9JCR4t5hNIMDrbiWADfKKp9yfo,10280
17
17
  dashscope/api_entities/api_request_data.py,sha256=04rpYPNK1HkT3iTPJmZpquH621xcBbe8R8EGrDJSLt0,5514
@@ -23,7 +23,7 @@ dashscope/api_entities/encryption.py,sha256=rUCZx3wwVvS5oyKXEeWgyWPxM8Y5d4AaVdgx
23
23
  dashscope/api_entities/http_request.py,sha256=MTxYsbkK8oYWDp8ZPjrkdY9YbnQ9SEIy87riyJidMXo,16484
24
24
  dashscope/api_entities/websocket_request.py,sha256=PS0FU854-HjTbKa68f4GHa7-noFRMzKySJGfPkrrBjw,16146
25
25
  dashscope/app/__init__.py,sha256=xvSvU8O7m5u7vgIvJXTJektJZxmjT2Rpt_YwePH88XE,113
26
- dashscope/app/application.py,sha256=Whf_ij4RHOaY12_xdS8uj8HVNCwkTp_MRdrFTryF1Kg,9472
26
+ dashscope/app/application.py,sha256=79wnnvAAjWBJ8TtMUN6-B4FHBV7twkAOzhXg7yDJQxE,9620
27
27
  dashscope/app/application_response.py,sha256=XO6iOZlt7OXulvFS71zwAq_HXYkn3HLJdAimTWPP0B4,8568
28
28
  dashscope/assistants/__init__.py,sha256=hjCTuv13yFaXyUqlexAU-RaO0Ahq3P7VK9_LkSbkGVU,434
29
29
  dashscope/assistants/assistant_types.py,sha256=qVDSy0xcsMq_sAD7t_ppoGLBN2QDiHqarAAlW_CDDtY,4478
@@ -41,7 +41,7 @@ dashscope/audio/qwen_omni/omni_realtime.py,sha256=eBmoOxuKcfzMHuXsQWCrIIKmso9iEz
41
41
  dashscope/audio/qwen_tts/__init__.py,sha256=JS3axY1grqO0aTIJufZ3KS1JsU6yf6y4K2CQlNvUK9I,132
42
42
  dashscope/audio/qwen_tts/speech_synthesizer.py,sha256=7LHR-PXhn-VE1cCOp_82Jq0zE9rMc3xy3dszUeyLLNs,2927
43
43
  dashscope/audio/qwen_tts_realtime/__init__.py,sha256=vVkmeJr_mEAn_O0Rh5AU3ICg6qIZqppUryJ5lY8VYPo,254
44
- dashscope/audio/qwen_tts_realtime/qwen_tts_realtime.py,sha256=8bOAMcDasTHwSLb9xAGJoj9eUPpQHh2aWvonV6Kf1U4,10367
44
+ dashscope/audio/qwen_tts_realtime/qwen_tts_realtime.py,sha256=uMLglxRjUZgol9Z7MTUY1Ji_HvaQaayjYkZvRkrNpkQ,10606
45
45
  dashscope/audio/tts/__init__.py,sha256=xYpMFseUZGgqgj_70zcX2VsLv-L7qxJ3d-bbdj_hO0I,245
46
46
  dashscope/audio/tts/speech_synthesizer.py,sha256=vD1xQV-rew8qAsIaAGH5amsNtB0SqdtNhVHhJHGQ-xk,7622
47
47
  dashscope/audio/tts_v2/__init__.py,sha256=me9a3_7KsHQxcJ8hx4SeKlY1e_ThHVvGMw7Yn0uoscM,333
@@ -100,9 +100,9 @@ dashscope/tokenizers/tokenizer.py,sha256=3FQVDvMNkCW9ccYeJdjrd_PIMMD3Xv7aNZkaYOE
100
100
  dashscope/tokenizers/tokenizer_base.py,sha256=5EJIFuizMWESEmLmbd38yJnfeHmPnzZPwsO4aOGjpl4,707
101
101
  dashscope/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
102
102
  dashscope/utils/oss_utils.py,sha256=aZIHlMN2JOfVw6kp0SVrMw_N1MfoTcR_-wiRbJ7DgHw,7501
103
- dashscope-1.24.5.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
104
- dashscope-1.24.5.dist-info/METADATA,sha256=eRxoK1TphMD4hn-vUM3aPMtaCsvCzstnDe-QPH9A4Q0,7146
105
- dashscope-1.24.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
106
- dashscope-1.24.5.dist-info/entry_points.txt,sha256=e9C3sOf9zDYL0O5ROEGX6FT8w-QK_kaGRWmPZDHAFys,49
107
- dashscope-1.24.5.dist-info/top_level.txt,sha256=woqavFJK9zas5xTqynmALqOtlafghjsk63Xk86powTU,10
108
- dashscope-1.24.5.dist-info/RECORD,,
103
+ dashscope-1.24.7.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
104
+ dashscope-1.24.7.dist-info/METADATA,sha256=3YnzYbPbSB-pNzn3CNw_Ka5MTDXM8oc_-ddrkugwav4,7146
105
+ dashscope-1.24.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
106
+ dashscope-1.24.7.dist-info/entry_points.txt,sha256=e9C3sOf9zDYL0O5ROEGX6FT8w-QK_kaGRWmPZDHAFys,49
107
+ dashscope-1.24.7.dist-info/top_level.txt,sha256=woqavFJK9zas5xTqynmALqOtlafghjsk63Xk86powTU,10
108
+ dashscope-1.24.7.dist-info/RECORD,,