dashscope 1.23.3__py3-none-any.whl → 1.23.4__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.

@@ -171,7 +171,7 @@ class ImageSynthesis(BaseAsyncApi):
171
171
  model, mask_image_url, api_key)
172
172
  if is_upload:
173
173
  has_upload = True
174
- input['mask_image_url'] = mask_image_url
174
+ input['mask_image_url'] = res_mask_image_url
175
175
 
176
176
  if base_image_url is not None and base_image_url:
177
177
  is_upload, res_base_image_url = check_and_upload_local(
@@ -12,14 +12,15 @@ from dashscope.common.logging import logger
12
12
 
13
13
 
14
14
  class VocabularyServiceException(Exception):
15
- def __init__(self, status_code: int, code: str,
15
+ def __init__(self, request_id: str, status_code: int, code: str,
16
16
  error_message: str) -> None:
17
+ self._request_id = request_id
17
18
  self._status_code = status_code
18
19
  self._code = code
19
20
  self._error_message = error_message
20
21
 
21
22
  def __str__(self):
22
- return f'Status Code: {self._status_code}, Code: {self._code}, Error Message: {self._error_message}'
23
+ return f'Request: {self._request_id}, Status Code: {self._status_code}, Code: {self._code}, Error Message: {self._error_message}'
23
24
 
24
25
 
25
26
  class VocabularyService(BaseApi):
@@ -86,7 +87,7 @@ class VocabularyService(BaseApi):
86
87
  self._last_request_id = response.request_id
87
88
  return response.output['vocabulary_id']
88
89
  else:
89
- raise VocabularyServiceException(response.status_code,
90
+ raise VocabularyServiceException(response.request_id, response.status_code,
90
91
  response.code, response.message)
91
92
 
92
93
  def list_vocabularies(self,
@@ -117,7 +118,7 @@ class VocabularyService(BaseApi):
117
118
  self._last_request_id = response.request_id
118
119
  return response.output['vocabulary_list']
119
120
  else:
120
- raise VocabularyServiceException(response.status_code,
121
+ raise VocabularyServiceException(response.request_id, response.status_code,
121
122
  response.code, response.message)
122
123
 
123
124
  def query_vocabulary(self, vocabulary_id: str) -> List[dict]:
@@ -134,7 +135,7 @@ class VocabularyService(BaseApi):
134
135
  self._last_request_id = response.request_id
135
136
  return response.output
136
137
  else:
137
- raise VocabularyServiceException(response.status_code,
138
+ raise VocabularyServiceException(response.request_id, response.status_code,
138
139
  response.code, response.message)
139
140
 
140
141
  def update_vocabulary(self, vocabulary_id: str,
@@ -153,7 +154,7 @@ class VocabularyService(BaseApi):
153
154
  self._last_request_id = response.request_id
154
155
  return
155
156
  else:
156
- raise VocabularyServiceException(response.status_code,
157
+ raise VocabularyServiceException(response.request_id, response.status_code,
157
158
  response.code, response.message)
158
159
 
159
160
  def delete_vocabulary(self, vocabulary_id: str) -> None:
@@ -169,7 +170,7 @@ class VocabularyService(BaseApi):
169
170
  self._last_request_id = response.request_id
170
171
  return
171
172
  else:
172
- raise VocabularyServiceException(response.status_code,
173
+ raise VocabularyServiceException(response.request_id, response.status_code,
173
174
  response.code, response.message)
174
175
 
175
176
  def get_last_request_id(self):
@@ -12,14 +12,15 @@ from dashscope.common.logging import logger
12
12
 
13
13
 
14
14
  class VoiceEnrollmentException(Exception):
15
- def __init__(self, status_code: int, code: str,
15
+ def __init__(self, request_id: str, status_code: int, code: str,
16
16
  error_message: str) -> None:
17
+ self._request_id = request_id
17
18
  self._status_code = status_code
18
19
  self._code = code
19
20
  self._error_message = error_message
20
21
 
21
22
  def __str__(self):
22
- return f'Status Code: {self._status_code}, Code: {self._code}, Error Message: {self._error_message}'
23
+ return f'Request: {self._request_id}, Status Code: {self._status_code}, Code: {self._code}, Error Message: {self._error_message}'
23
24
 
24
25
 
25
26
  class VoiceEnrollmentService(BaseApi):
@@ -81,11 +82,11 @@ class VoiceEnrollmentService(BaseApi):
81
82
  'prefix': prefix,
82
83
  'url': url,
83
84
  }, )
85
+ self._last_request_id = response.request_id
84
86
  if response.status_code == 200:
85
- self._last_request_id = response.request_id
86
87
  return response.output['voice_id']
87
88
  else:
88
- raise VoiceEnrollmentException(response.status_code, response.code,
89
+ raise VoiceEnrollmentException(response.request_id, response.status_code, response.code,
89
90
  response.message)
90
91
 
91
92
  def list_voices(self,
@@ -111,11 +112,11 @@ class VoiceEnrollmentService(BaseApi):
111
112
  'page_index': page_index,
112
113
  'page_size': page_size,
113
114
  }, )
115
+ self._last_request_id = response.request_id
114
116
  if response.status_code == 200:
115
- self._last_request_id = response.request_id
116
117
  return response.output['voice_list']
117
118
  else:
118
- raise VoiceEnrollmentException(response.status_code, response.code,
119
+ raise VoiceEnrollmentException(response.request_id, response.status_code, response.code,
119
120
  response.message)
120
121
 
121
122
  def query_voice(self, voice_id: str) -> List[str]:
@@ -128,11 +129,11 @@ class VoiceEnrollmentService(BaseApi):
128
129
  'action': 'query_voice',
129
130
  'voice_id': voice_id,
130
131
  }, )
132
+ self._last_request_id = response.request_id
131
133
  if response.status_code == 200:
132
- self._last_request_id = response.request_id
133
134
  return response.output
134
135
  else:
135
- raise VoiceEnrollmentException(response.status_code, response.code,
136
+ raise VoiceEnrollmentException(response.request_id, response.status_code, response.code,
136
137
  response.message)
137
138
 
138
139
  def update_voice(self, voice_id: str, url: str) -> None:
@@ -146,11 +147,11 @@ class VoiceEnrollmentService(BaseApi):
146
147
  'voice_id': voice_id,
147
148
  'url': url,
148
149
  }, )
150
+ self._last_request_id = response.request_id
149
151
  if response.status_code == 200:
150
- self._last_request_id = response.request_id
151
152
  return
152
153
  else:
153
- raise VoiceEnrollmentException(response.status_code, response.code,
154
+ raise VoiceEnrollmentException(response.request_id, response.status_code, response.code,
154
155
  response.message)
155
156
 
156
157
  def delete_voice(self, voice_id: str) -> None:
@@ -162,11 +163,11 @@ class VoiceEnrollmentService(BaseApi):
162
163
  'action': 'delete_voice',
163
164
  'voice_id': voice_id,
164
165
  }, )
166
+ self._last_request_id = response.request_id
165
167
  if response.status_code == 200:
166
- self._last_request_id = response.request_id
167
168
  return
168
169
  else:
169
- raise VoiceEnrollmentException(response.status_code, response.code,
170
+ raise VoiceEnrollmentException(response.request_id, response.status_code, response.code,
170
171
  response.message)
171
172
 
172
173
  def get_last_request_id(self):
@@ -134,9 +134,7 @@ class Request:
134
134
  'task_group': 'audio',
135
135
  'task': 'tts',
136
136
  'function': 'SpeechSynthesizer',
137
- 'input': {
138
- 'text': ''
139
- },
137
+ 'input': {},
140
138
  'parameters': {
141
139
  'voice': self.voice,
142
140
  'volume': self.volume,
@@ -179,9 +177,7 @@ class Request:
179
177
  'streaming': WebsocketStreamingMode.DUPLEX,
180
178
  },
181
179
  'payload': {
182
- 'input': {
183
- 'text': ''
184
- },
180
+ 'input': {},
185
181
  },
186
182
  }
187
183
  return json.dumps(cmd)
@@ -514,6 +510,10 @@ class SpeechSynthesizer:
514
510
  otherwise, it will wait indefinitely.
515
511
  """
516
512
  # print('还不支持非流式语音合成sdk调用大模型,使用流式模拟')
513
+ if self.additional_params is None:
514
+ self.additional_params = {"enable_ssml":True}
515
+ else:
516
+ self.additional_params["enable_ssml"] = True
517
517
  if not self.callback:
518
518
  self.callback = ResultCallback()
519
519
  self.__start_stream()
dashscope/version.py CHANGED
@@ -1,3 +1,3 @@
1
1
  # Copyright (c) Alibaba, Inc. and its affiliates.
2
2
 
3
- __version__ = '1.23.3'
3
+ __version__ = '1.23.4'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dashscope
3
- Version: 1.23.3
3
+ Version: 1.23.4
4
4
  Summary: dashscope client sdk library
5
5
  Home-page: https://dashscope.aliyun.com/
6
6
  Author: Alibaba Cloud
@@ -3,13 +3,13 @@ dashscope/cli.py,sha256=amegoTkGOs6TlHMdoo4JVOqBePo3lGs745rc7leEyrE,24020
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=KoL2HDS3KUg-imtukZreW80cuyVG_B6Uy4FbPH7nZe4,74
6
+ dashscope/version.py,sha256=rYR28JeS4-X9sqFHDXfo67jzYyRueQgOduJuayh5uEs,74
7
7
  dashscope/aigc/__init__.py,sha256=AuRhu_vA1K0tbs_C6DgcZYhTvxMuzDgpwHJNHzEPIHg,442
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=RGyjhSl1-5YzaYBtAMaoemh6Ij_Xw0l_z9IGKD5qgWI,13359
12
+ dashscope/aigc/image_synthesis.py,sha256=Jgqmyv4jRxikgX7J18QrKKQ4OZAMxs6Q6YXObae3DhI,13363
13
13
  dashscope/aigc/multimodal_conversation.py,sha256=1rZZRk_1lCdbVs7Rx1kJ5LvwWE1put5p_dQKdCX0ysY,5574
14
14
  dashscope/aigc/video_synthesis.py,sha256=XQ3-NKYFmj5cIbUbLTbI0-FyC_fQp8eds6QmD1ZHj_0,13015
15
15
  dashscope/api_entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -34,14 +34,14 @@ dashscope/audio/asr/asr_phrase_manager.py,sha256=vHOLExaKCtjedkihIu7gyfQyarR9rN5
34
34
  dashscope/audio/asr/recognition.py,sha256=b_aAPvOKjpWdSiYhM_hp30sZ06QdmNBSDJwhiv78kHM,20932
35
35
  dashscope/audio/asr/transcription.py,sha256=lYzPjh7jJQwjMoxx8-AY0YCMBKNKO0bi7xd5tZGSHPc,9094
36
36
  dashscope/audio/asr/translation_recognizer.py,sha256=JgBmhkIl_kqH8uVwop6Fba5KlXccftKFrhaygN9PKjU,39680
37
- dashscope/audio/asr/vocabulary.py,sha256=TEmN4JqXFpg9c1o3BUyj-rA7L58T85iURukJIupEiv0,6528
37
+ dashscope/audio/asr/vocabulary.py,sha256=N0pMS2x1lDxqJ14FgTGKctfuVkR2_hlEsCNWFcgYpTY,6717
38
38
  dashscope/audio/qwen_tts/__init__.py,sha256=JS3axY1grqO0aTIJufZ3KS1JsU6yf6y4K2CQlNvUK9I,132
39
39
  dashscope/audio/qwen_tts/speech_synthesizer.py,sha256=7LHR-PXhn-VE1cCOp_82Jq0zE9rMc3xy3dszUeyLLNs,2927
40
40
  dashscope/audio/tts/__init__.py,sha256=xYpMFseUZGgqgj_70zcX2VsLv-L7qxJ3d-bbdj_hO0I,245
41
41
  dashscope/audio/tts/speech_synthesizer.py,sha256=vD1xQV-rew8qAsIaAGH5amsNtB0SqdtNhVHhJHGQ-xk,7622
42
42
  dashscope/audio/tts_v2/__init__.py,sha256=me9a3_7KsHQxcJ8hx4SeKlY1e_ThHVvGMw7Yn0uoscM,333
43
- dashscope/audio/tts_v2/enrollment.py,sha256=DlkV4P1unbtgg9vQNfDfnBqA61yYtIwRHgUdwPh4AF4,6192
44
- dashscope/audio/tts_v2/speech_synthesizer.py,sha256=aL_VNKMYwiw5pKv3SvuAzWtZF0bpyvntc3Kh_iJroNM,19980
43
+ dashscope/audio/tts_v2/enrollment.py,sha256=-nrlywYSOP73Bm9ETTSxNnlp-B8ezJcUmd59mVvyvgk,6361
44
+ dashscope/audio/tts_v2/speech_synthesizer.py,sha256=qUoLga8HpvNVdbN5n_orxrgZ28yD6Lhwuwqeoi1T7yA,20056
45
45
  dashscope/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
46
46
  dashscope/client/base_api.py,sha256=aWNy_xm02GXuLKVgWnYJht2nI4ZHSGfYIcr52SML15A,41239
47
47
  dashscope/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -87,9 +87,9 @@ dashscope/tokenizers/tokenizer.py,sha256=3FQVDvMNkCW9ccYeJdjrd_PIMMD3Xv7aNZkaYOE
87
87
  dashscope/tokenizers/tokenizer_base.py,sha256=5EJIFuizMWESEmLmbd38yJnfeHmPnzZPwsO4aOGjpl4,707
88
88
  dashscope/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
89
89
  dashscope/utils/oss_utils.py,sha256=L5LN3lN8etVxSL_jkZydstvEKpnTG9CY0zcvPGQ5LBo,7383
90
- dashscope-1.23.3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
91
- dashscope-1.23.3.dist-info/METADATA,sha256=lqzVJ_GvC8JbdUYLTDjC2OL0bdp1Vzk5RaMD9aFIkYE,6798
92
- dashscope-1.23.3.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
93
- dashscope-1.23.3.dist-info/entry_points.txt,sha256=raEp5dOuj8whJ7yqZlDM8WQ5p2RfnGrGNo0QLQEnatY,50
94
- dashscope-1.23.3.dist-info/top_level.txt,sha256=woqavFJK9zas5xTqynmALqOtlafghjsk63Xk86powTU,10
95
- dashscope-1.23.3.dist-info/RECORD,,
90
+ dashscope-1.23.4.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
91
+ dashscope-1.23.4.dist-info/METADATA,sha256=AyHZs_Sy4pMKuqtcXIb7HeYRho4kWAxr8T5yD3tia-o,6798
92
+ dashscope-1.23.4.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
93
+ dashscope-1.23.4.dist-info/entry_points.txt,sha256=raEp5dOuj8whJ7yqZlDM8WQ5p2RfnGrGNo0QLQEnatY,50
94
+ dashscope-1.23.4.dist-info/top_level.txt,sha256=woqavFJK9zas5xTqynmALqOtlafghjsk63Xk86powTU,10
95
+ dashscope-1.23.4.dist-info/RECORD,,