dashscope 1.24.6__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
 
@@ -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}
dashscope/version.py CHANGED
@@ -1,3 +1,3 @@
1
1
  # Copyright (c) Alibaba, Inc. and its affiliates.
2
2
 
3
- __version__ = '1.24.6'
3
+ __version__ = '1.24.7'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dashscope
3
- Version: 1.24.6
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=JqxudsXng54szjAiYPU1SF6csQl4dgfVKBuLLIxDvFk,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
12
+ dashscope/aigc/image_synthesis.py,sha256=sKKKmc11nwNSBEuhLb6ymUr5pxVAAl87uB-ALuh0dLE,28851
13
13
  dashscope/aigc/multimodal_conversation.py,sha256=k-OPWwgrWJBb7LiUdFuuP9X6sR5ukbaRHPqFTSikO7Y,12380
14
- dashscope/aigc/video_synthesis.py,sha256=RSPjar5-YiF9xclRmf9H7-5QbRxLcsNXO4zS7oTKi2I,24137
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
@@ -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.6.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
104
- dashscope-1.24.6.dist-info/METADATA,sha256=ClDqUPyIROfxsTfLRRM4YsbEOPU7S8HRc_-eo5sPtw0,7146
105
- dashscope-1.24.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
106
- dashscope-1.24.6.dist-info/entry_points.txt,sha256=e9C3sOf9zDYL0O5ROEGX6FT8w-QK_kaGRWmPZDHAFys,49
107
- dashscope-1.24.6.dist-info/top_level.txt,sha256=woqavFJK9zas5xTqynmALqOtlafghjsk63Xk86powTU,10
108
- dashscope-1.24.6.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,,