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

Files changed (56) hide show
  1. dashscope/__init__.py +57 -10
  2. dashscope/aigc/code_generation.py +12 -9
  3. dashscope/aigc/conversation.py +3 -0
  4. dashscope/aigc/generation.py +3 -0
  5. dashscope/aigc/image_synthesis.py +26 -6
  6. dashscope/aigc/multimodal_conversation.py +3 -0
  7. dashscope/api_entities/aiohttp_request.py +1 -0
  8. dashscope/api_entities/api_request_factory.py +28 -12
  9. dashscope/api_entities/dashscope_response.py +63 -0
  10. dashscope/api_entities/http_request.py +21 -31
  11. dashscope/api_entities/websocket_request.py +3 -0
  12. dashscope/app/application.py +16 -18
  13. dashscope/assistants/__init__.py +14 -0
  14. dashscope/assistants/assistant_types.py +164 -0
  15. dashscope/assistants/assistants.py +280 -0
  16. dashscope/assistants/files.py +189 -0
  17. dashscope/audio/asr/asr_phrase_manager.py +27 -5
  18. dashscope/audio/asr/recognition.py +10 -2
  19. dashscope/audio/asr/transcription.py +21 -3
  20. dashscope/audio/tts/speech_synthesizer.py +3 -0
  21. dashscope/cli.py +7 -7
  22. dashscope/client/base_api.py +317 -70
  23. dashscope/common/base_type.py +130 -0
  24. dashscope/common/constants.py +1 -0
  25. dashscope/common/error.py +4 -0
  26. dashscope/common/utils.py +159 -27
  27. dashscope/deployment.py +40 -6
  28. dashscope/embeddings/batch_text_embedding.py +24 -7
  29. dashscope/embeddings/multimodal_embedding.py +3 -0
  30. dashscope/embeddings/text_embedding.py +8 -1
  31. dashscope/files.py +107 -0
  32. dashscope/finetune.py +31 -7
  33. dashscope/model.py +9 -2
  34. dashscope/models.py +47 -0
  35. dashscope/nlp/understanding.py +2 -2
  36. dashscope/rerank/__init__.py +0 -0
  37. dashscope/rerank/text_rerank.py +67 -0
  38. dashscope/threads/__init__.py +24 -0
  39. dashscope/threads/messages/__init__.py +0 -0
  40. dashscope/threads/messages/files.py +111 -0
  41. dashscope/threads/messages/messages.py +218 -0
  42. dashscope/threads/runs/__init__.py +0 -0
  43. dashscope/threads/runs/runs.py +483 -0
  44. dashscope/threads/runs/steps.py +110 -0
  45. dashscope/threads/thread_types.py +651 -0
  46. dashscope/threads/threads.py +210 -0
  47. dashscope/tokenizers/tokenization.py +3 -0
  48. dashscope/utils/oss_utils.py +11 -0
  49. dashscope/version.py +1 -1
  50. {dashscope-1.15.0.dist-info → dashscope-1.18.0.dist-info}/METADATA +2 -3
  51. dashscope-1.18.0.dist-info/RECORD +84 -0
  52. dashscope-1.15.0.dist-info/RECORD +0 -66
  53. {dashscope-1.15.0.dist-info → dashscope-1.18.0.dist-info}/LICENSE +0 -0
  54. {dashscope-1.15.0.dist-info → dashscope-1.18.0.dist-info}/WHEEL +0 -0
  55. {dashscope-1.15.0.dist-info → dashscope-1.18.0.dist-info}/entry_points.txt +0 -0
  56. {dashscope-1.15.0.dist-info → dashscope-1.18.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,189 @@
1
+ from dashscope.assistants.assistant_types import (AssistantFile,
2
+ AssistantFileList,
3
+ DeleteResponse)
4
+ from dashscope.client.base_api import (CreateMixin, DeleteMixin,
5
+ GetStatusMixin, ListObjectMixin)
6
+ from dashscope.common.error import InputRequired
7
+
8
+ __all__ = ['Files']
9
+
10
+
11
+ class Files(CreateMixin, DeleteMixin, ListObjectMixin, GetStatusMixin):
12
+ SUB_PATH = 'assistants'
13
+
14
+ @classmethod
15
+ def call(cls,
16
+ assistant_id: str,
17
+ *,
18
+ file_id: str,
19
+ workspace: str = None,
20
+ api_key: str = None,
21
+ **kwargs) -> AssistantFile:
22
+ """Create assistant file.
23
+
24
+ Args:
25
+ assistant_id (str): The target assistant id.
26
+ file_id (str): The file id.
27
+ workspace (str, optional): The DashScope workspace id. Defaults to None.
28
+ api_key (str, optional): The DashScope api key. Defaults to None.
29
+
30
+ Raises:
31
+ InputRequired: The assistant id and file id are required.
32
+
33
+ Returns:
34
+ AssistantFile: The assistant file object.
35
+ """
36
+ return cls.create(assistant_id,
37
+ file_id=file_id,
38
+ workspace=workspace,
39
+ api_key=api_key,
40
+ **kwargs)
41
+
42
+ @classmethod
43
+ def create(cls,
44
+ assistant_id: str,
45
+ *,
46
+ file_id: str,
47
+ workspace: str = None,
48
+ api_key: str = None,
49
+ **kwargs) -> AssistantFile:
50
+ """Create assistant file.
51
+
52
+ Args:
53
+ assistant_id (str): The target assistant id.
54
+ file_id (str): The file id.
55
+ workspace (str, optional): The DashScope workspace id. Defaults to None.
56
+ api_key (str, optional): The DashScope api key. Defaults to None.
57
+
58
+ Raises:
59
+ InputRequired: The assistant id and file id is required.
60
+
61
+ Returns:
62
+ AssistantFile: _description_
63
+ """
64
+ if not file_id or not assistant_id:
65
+ raise InputRequired('input file_id and assistant_id is required!')
66
+
67
+ response = super().call(data={'file_id': file_id},
68
+ path=f'assistants/{assistant_id}/files',
69
+ api_key=api_key,
70
+ flattened_output=True,
71
+ workspace=workspace,
72
+ **kwargs)
73
+ return AssistantFile(**response)
74
+
75
+ @classmethod
76
+ def list(cls,
77
+ assistant_id: str,
78
+ *,
79
+ limit: int = None,
80
+ order: str = None,
81
+ after: str = None,
82
+ before: str = None,
83
+ workspace: str = None,
84
+ api_key: str = None,
85
+ **kwargs) -> AssistantFileList:
86
+ """List assistant files.
87
+
88
+ Args:
89
+ assistant_id (str): The assistant id.
90
+ limit (int, optional): How many assistant to retrieve. Defaults to None.
91
+ order (str, optional): Sort order by created_at. Defaults to None.
92
+ after (str, optional): Assistant id after. Defaults to None.
93
+ before (str, optional): Assistant id before. Defaults to None.
94
+ workspace (str, optional): The DashScope workspace id. Defaults to None.
95
+ api_key (str, optional): Your DashScope api key. Defaults to None.
96
+
97
+ Returns:
98
+ ListAssistantFile: The list of file objects.
99
+ """
100
+
101
+ response = super().list(limit=limit,
102
+ order=order,
103
+ after=after,
104
+ before=before,
105
+ path=f'assistants/{assistant_id}/files',
106
+ api_key=api_key,
107
+ flattened_output=True,
108
+ workspace=workspace,
109
+ **kwargs)
110
+ return AssistantFileList(**response)
111
+
112
+ @classmethod
113
+ def retrieve(cls,
114
+ file_id: str,
115
+ *,
116
+ assistant_id: str,
117
+ workspace: str = None,
118
+ api_key: str = None,
119
+ **kwargs) -> AssistantFile:
120
+ """Retrieve file information.
121
+
122
+ Args:
123
+ file_id (str): The file if.
124
+ assistant_id (str): The assistant id of the file.
125
+ workspace (str, optional): The DashScope workspace id. Defaults to None.
126
+ api_key (str, optional): Your DashScope api key. Defaults to None.
127
+
128
+ Returns:
129
+ AssistantFile: The `AssistantFile` object.
130
+ """
131
+ if not assistant_id or not file_id:
132
+ raise InputRequired('assistant id and file id are required!')
133
+ response = super().get(
134
+ file_id,
135
+ path=f'assistants/{assistant_id}/files/{file_id}',
136
+ api_key=api_key,
137
+ flattened_output=True,
138
+ workspace=workspace,
139
+ **kwargs)
140
+ return AssistantFile(**response)
141
+
142
+ @classmethod
143
+ def get(cls,
144
+ file_id: str,
145
+ *,
146
+ assistant_id: str,
147
+ workspace: str = None,
148
+ api_key: str = None,
149
+ **kwargs) -> AssistantFile:
150
+ """Retrieve file information.
151
+
152
+ Args:
153
+ file_id (str): The file if.
154
+ assistant_id (str): The assistant id of the file.
155
+ workspace (str, optional): The DashScope workspace id. Defaults to None.
156
+ api_key (str, optional): Your DashScope api key. Defaults to None.
157
+
158
+ Returns:
159
+ AssistantFile: The `AssistantFile` object.
160
+ """
161
+
162
+ @classmethod
163
+ def delete(cls,
164
+ file_id: str,
165
+ *,
166
+ assistant_id: str,
167
+ workspace: str = None,
168
+ api_key: str = None,
169
+ **kwargs) -> DeleteResponse:
170
+ """Delete the `file_id`.
171
+
172
+ Args:
173
+ file_id (str): The file to be deleted.
174
+ assistant_id (str): The assistant id of the file.
175
+ workspace (str, optional): The DashScope workspace id. Defaults to None.
176
+ api_key (str, optional): Your DashScope api key. Defaults to None.
177
+
178
+ Returns:
179
+ AssistantsDeleteResponse: _description_
180
+ """
181
+
182
+ response = super().delete(
183
+ file_id,
184
+ path=f'assistants/{assistant_id}/files/{file_id}',
185
+ api_key=api_key,
186
+ flattened_output=True,
187
+ workspace=workspace,
188
+ **kwargs)
189
+ return DeleteResponse(**response)
@@ -16,6 +16,7 @@ class AsrPhraseManager(BaseAsyncApi):
16
16
  model: str,
17
17
  phrases: Dict[str, Any],
18
18
  training_type: str = 'compile_asr_phrase',
19
+ workspace: str = None,
19
20
  **kwargs) -> DashScopeAPIResponse:
20
21
  """Create hot words.
21
22
 
@@ -25,6 +26,7 @@ class AsrPhraseManager(BaseAsyncApi):
25
26
  such as {'下一首':90,'上一首':90}.
26
27
  training_type (str, `optional`): The training type,
27
28
  'compile_asr_phrase' is default.
29
+ workspace (str): The dashscope workspace id.
28
30
 
29
31
  Raises:
30
32
  InvalidParameter: Parameter input is None or empty!
@@ -44,6 +46,7 @@ class AsrPhraseManager(BaseAsyncApi):
44
46
  validation_file_ids=[],
45
47
  mode=training_type,
46
48
  hyper_parameters={'phrase_list': phrases},
49
+ workspace=workspace,
47
50
  **kwargs)
48
51
  FineTune.SUB_PATH = original_ft_sub_path
49
52
 
@@ -58,6 +61,7 @@ class AsrPhraseManager(BaseAsyncApi):
58
61
  phrase_id: str,
59
62
  phrases: Dict[str, Any],
60
63
  training_type: str = 'compile_asr_phrase',
64
+ workspace: str = None,
61
65
  **kwargs) -> DashScopeAPIResponse:
62
66
  """Update the hot words marked phrase_id.
63
67
 
@@ -69,6 +73,7 @@ class AsrPhraseManager(BaseAsyncApi):
69
73
  such as {'暂停':90}.
70
74
  training_type (str, `optional`):
71
75
  The training type, 'compile_asr_phrase' is default.
76
+ workspace (str): The dashscope workspace id.
72
77
 
73
78
  Raises:
74
79
  InvalidParameter: Parameter input is None or empty!
@@ -91,6 +96,7 @@ class AsrPhraseManager(BaseAsyncApi):
91
96
  mode=training_type,
92
97
  hyper_parameters={'phrase_list': phrases},
93
98
  finetuned_output=phrase_id,
99
+ workspace=workspace,
94
100
  **kwargs)
95
101
  FineTune.SUB_PATH = original_ft_sub_path
96
102
 
@@ -100,12 +106,16 @@ class AsrPhraseManager(BaseAsyncApi):
100
106
  return response
101
107
 
102
108
  @classmethod
103
- def query_phrases(cls, phrase_id: str, **kwargs) -> DashScopeAPIResponse:
109
+ def query_phrases(cls,
110
+ phrase_id: str,
111
+ workspace: str = None,
112
+ **kwargs) -> DashScopeAPIResponse:
104
113
  """Query the hot words by phrase_id.
105
114
 
106
115
  Args:
107
116
  phrase_id (str): The ID of phrases,
108
117
  which created by create_phrases().
118
+ workspace (str): The dashscope workspace id.
109
119
 
110
120
  Raises:
111
121
  InvalidParameter: phrase_id input is None or empty!
@@ -118,7 +128,9 @@ class AsrPhraseManager(BaseAsyncApi):
118
128
 
119
129
  original_ft_sub_path = FineTune.SUB_PATH
120
130
  FineTune.SUB_PATH = 'fine-tunes/outputs'
121
- response = FineTune.get(job_id=phrase_id, **kwargs)
131
+ response = FineTune.get(job_id=phrase_id,
132
+ workspace=workspace,
133
+ **kwargs)
122
134
  FineTune.SUB_PATH = original_ft_sub_path
123
135
 
124
136
  if response.status_code != HTTPStatus.OK:
@@ -130,6 +142,7 @@ class AsrPhraseManager(BaseAsyncApi):
130
142
  def list_phrases(cls,
131
143
  page: int = 1,
132
144
  page_size: int = 10,
145
+ workspace: str = None,
133
146
  **kwargs) -> DashScopeAPIResponse:
134
147
  """List all information of phrases.
135
148
 
@@ -137,13 +150,17 @@ class AsrPhraseManager(BaseAsyncApi):
137
150
  page (int): Page number, greater than 0, default value 1.
138
151
  page_size (int): The paging size, greater than 0
139
152
  and less than or equal to 100, default value 10.
153
+ workspace (str): The dashscope workspace id.
140
154
 
141
155
  Returns:
142
156
  DashScopeAPIResponse: The results of listing hot words.
143
157
  """
144
158
  original_ft_sub_path = FineTune.SUB_PATH
145
159
  FineTune.SUB_PATH = 'fine-tunes/outputs'
146
- response = FineTune.list(page=page, page_size=page_size, **kwargs)
160
+ response = FineTune.list(page=page,
161
+ page_size=page_size,
162
+ workspace=workspace,
163
+ **kwargs)
147
164
  FineTune.SUB_PATH = original_ft_sub_path
148
165
 
149
166
  if response.status_code != HTTPStatus.OK:
@@ -152,7 +169,10 @@ class AsrPhraseManager(BaseAsyncApi):
152
169
  return response
153
170
 
154
171
  @classmethod
155
- def delete_phrases(cls, phrase_id: str, **kwargs) -> DashScopeAPIResponse:
172
+ def delete_phrases(cls,
173
+ phrase_id: str,
174
+ workspace: str = None,
175
+ **kwargs) -> DashScopeAPIResponse:
156
176
  """Delete the hot words by phrase_id.
157
177
 
158
178
  Args:
@@ -170,7 +190,9 @@ class AsrPhraseManager(BaseAsyncApi):
170
190
 
171
191
  original_ft_sub_path = FineTune.SUB_PATH
172
192
  FineTune.SUB_PATH = 'fine-tunes/outputs'
173
- response = FineTune.delete(job_id=phrase_id, **kwargs)
193
+ response = FineTune.delete(job_id=phrase_id,
194
+ workspace=workspace,
195
+ **kwargs)
174
196
  FineTune.SUB_PATH = original_ft_sub_path
175
197
 
176
198
  if response.status_code != HTTPStatus.OK:
@@ -110,6 +110,7 @@ class Recognition(BaseApi):
110
110
  speech recognition results.
111
111
  format (str): The input audio format for speech recognition.
112
112
  sample_rate (int): The input audio sample rate for speech recognition.
113
+ workspace (str): The dashscope workspace id.
113
114
 
114
115
  **kwargs:
115
116
  phrase_id (list, `optional`): The ID of phrase.
@@ -130,8 +131,13 @@ class Recognition(BaseApi):
130
131
 
131
132
  SILENCE_TIMEOUT_S = 23
132
133
 
133
- def __init__(self, model: str, callback: RecognitionCallback, format: str,
134
- sample_rate: int, **kwargs):
134
+ def __init__(self,
135
+ model: str,
136
+ callback: RecognitionCallback,
137
+ format: str,
138
+ sample_rate: int,
139
+ workspace: str = None,
140
+ **kwargs):
135
141
  if model is None:
136
142
  raise ModelRequired('Model is required!')
137
143
  if format is None:
@@ -150,6 +156,7 @@ class Recognition(BaseApi):
150
156
  self._worker = None
151
157
  self._silence_timer = None
152
158
  self._kwargs = kwargs
159
+ self._workspace = workspace
153
160
 
154
161
  def __del__(self):
155
162
  if self._running:
@@ -220,6 +227,7 @@ class Recognition(BaseApi):
220
227
  sample_rate=self.sample_rate,
221
228
  format=self.format,
222
229
  stream=True,
230
+ workspace=self._workspace,
223
231
  **self._kwargs)
224
232
  return responses
225
233
 
@@ -29,6 +29,7 @@ class Transcription(BaseAsyncApi):
29
29
  file_urls: List[str],
30
30
  phrase_id: str = None,
31
31
  api_key: str = None,
32
+ workspace: str = None,
32
33
  **kwargs) -> TranscriptionResponse:
33
34
  """Transcribe the given files synchronously.
34
35
 
@@ -36,6 +37,7 @@ class Transcription(BaseAsyncApi):
36
37
  model (str): The requested model_id.
37
38
  file_urls (List[str]): List of stored URLs.
38
39
  phrase_id (str, `optional`): The ID of phrase.
40
+ workspace (str): The dashscope workspace id.
39
41
 
40
42
  **kwargs:
41
43
  channel_id (List[int], optional):
@@ -56,7 +58,11 @@ class Transcription(BaseAsyncApi):
56
58
  """
57
59
  kwargs.update(cls._fill_resource_id(phrase_id, **kwargs))
58
60
  kwargs = cls._tidy_kwargs(**kwargs)
59
- response = super().call(model, file_urls, api_key=api_key, **kwargs)
61
+ response = super().call(model,
62
+ file_urls,
63
+ api_key=api_key,
64
+ workspace=workspace,
65
+ **kwargs)
60
66
  return TranscriptionResponse.from_api_response(response)
61
67
 
62
68
  @classmethod
@@ -65,6 +71,7 @@ class Transcription(BaseAsyncApi):
65
71
  file_urls: List[str],
66
72
  phrase_id: str = None,
67
73
  api_key: str = None,
74
+ workspace: str = None,
68
75
  **kwargs) -> TranscriptionResponse:
69
76
  """Transcribe the given files asynchronously,
70
77
  return the status of task submission for querying results subsequently.
@@ -73,6 +80,7 @@ class Transcription(BaseAsyncApi):
73
80
  model (str): The requested model, such as paraformer-16k-1
74
81
  file_urls (List[str]): List of stored URLs.
75
82
  phrase_id (str, `optional`): The ID of phrase.
83
+ workspace (str): The dashscope workspace id.
76
84
 
77
85
  **kwargs:
78
86
  channel_id (List[int], optional):
@@ -96,6 +104,7 @@ class Transcription(BaseAsyncApi):
96
104
  response = cls._launch_request(model,
97
105
  file_urls,
98
106
  api_key=api_key,
107
+ workspace=workspace,
99
108
  **kwargs)
100
109
  return TranscriptionResponse.from_api_response(response)
101
110
 
@@ -104,12 +113,14 @@ class Transcription(BaseAsyncApi):
104
113
  cls,
105
114
  task: Union[str, TranscriptionResponse],
106
115
  api_key: str = None,
116
+ workspace: str = None,
107
117
  ) -> TranscriptionResponse:
108
118
  """Fetch the status of task, including results of batch transcription when task_status is SUCCEEDED. # noqa: E501
109
119
 
110
120
  Args:
111
121
  task (Union[str, TranscriptionResponse]): The task_id or
112
122
  response including task_id returned from async_call().
123
+ workspace (str): The dashscope workspace id.
113
124
 
114
125
  Returns:
115
126
  TranscriptionResponse: The status of task_id,
@@ -118,7 +129,9 @@ class Transcription(BaseAsyncApi):
118
129
  try_count: int = 0
119
130
  while True:
120
131
  try:
121
- response = super().fetch(task, api_key=api_key)
132
+ response = super().fetch(task,
133
+ api_key=api_key,
134
+ workspace=workspace)
122
135
  except (asyncio.TimeoutError, aiohttp.ClientConnectorError) as e:
123
136
  logger.error(e)
124
137
  try_count += 1
@@ -136,17 +149,19 @@ class Transcription(BaseAsyncApi):
136
149
  cls,
137
150
  task: Union[str, TranscriptionResponse],
138
151
  api_key: str = None,
152
+ workspace: str = None,
139
153
  ) -> TranscriptionResponse:
140
154
  """Poll task until the final results of transcription is obtained.
141
155
 
142
156
  Args:
143
157
  task (Union[str, TranscriptionResponse]): The task_id or
144
158
  response including task_id returned from async_call().
159
+ workspace (str): The dashscope workspace id.
145
160
 
146
161
  Returns:
147
162
  TranscriptionResponse: The result of batch transcription.
148
163
  """
149
- response = super().wait(task, api_key=api_key)
164
+ response = super().wait(task, api_key=api_key, workspace=workspace)
150
165
  return TranscriptionResponse.from_api_response(response)
151
166
 
152
167
  @classmethod
@@ -154,12 +169,14 @@ class Transcription(BaseAsyncApi):
154
169
  model: str,
155
170
  files: List[str],
156
171
  api_key: str = None,
172
+ workspace: str = None,
157
173
  **kwargs) -> DashScopeAPIResponse:
158
174
  """Submit transcribe request.
159
175
 
160
176
  Args:
161
177
  model (str): The requested model, such as paraformer-16k-1
162
178
  files (List[str]): List of stored URLs.
179
+ workspace (str): The dashscope workspace id.
163
180
 
164
181
  Returns:
165
182
  DashScopeAPIResponse: The result of task submission.
@@ -177,6 +194,7 @@ class Transcription(BaseAsyncApi):
177
194
  api_protocol=ApiProtocol.HTTP,
178
195
  http_method=HTTPMethod.POST,
179
196
  api_key=api_key,
197
+ workspace=workspace,
180
198
  **kwargs)
181
199
  except (asyncio.TimeoutError, aiohttp.ClientConnectorError) as e:
182
200
  logger.error(e)
@@ -94,6 +94,7 @@ class SpeechSynthesizer(BaseApi):
94
94
  model: str,
95
95
  text: str,
96
96
  callback: ResultCallback = None,
97
+ workspace: str = None,
97
98
  **kwargs) -> SpeechSynthesisResult:
98
99
  """Convert text to speech synchronously.
99
100
 
@@ -102,6 +103,7 @@ class SpeechSynthesizer(BaseApi):
102
103
  text (str): Text content used for speech synthesis.
103
104
  callback (ResultCallback): A callback that returns
104
105
  speech synthesis results.
106
+ workspace (str): The dashscope workspace id.
105
107
  **kwargs:
106
108
  format(str, `optional`): Audio encoding format,
107
109
  such as pcm wav mp3, default is wav.
@@ -135,6 +137,7 @@ class SpeechSynthesizer(BaseApi):
135
137
  input={'text': text},
136
138
  stream=True,
137
139
  api_protocol=ApiProtocol.WEBSOCKET,
140
+ workspace=workspace,
138
141
  **kwargs)
139
142
 
140
143
  if _callback is not None:
dashscope/cli.py CHANGED
@@ -197,9 +197,9 @@ class FineTunes:
197
197
  class Files:
198
198
  @classmethod
199
199
  def upload(cls, args):
200
- rsp = dashscope.File.upload(file_path=args.file,
201
- purpose=args.purpose,
202
- description=args.description)
200
+ rsp = dashscope.Files.upload(file_path=args.file,
201
+ purpose=args.purpose,
202
+ description=args.description)
203
203
  print(rsp)
204
204
  if rsp.status_code == HTTPStatus.OK:
205
205
  print('Upload success, file id: %s' %
@@ -209,7 +209,7 @@ class Files:
209
209
 
210
210
  @classmethod
211
211
  def get(cls, args):
212
- rsp = dashscope.File.get(file_id=args.id)
212
+ rsp = dashscope.Files.get(file_id=args.id)
213
213
  if rsp.status_code == HTTPStatus.OK:
214
214
  print('file_id: %s, name: %s, description: %s' %
215
215
  (rsp.output['file_id'], rsp.output['name'],
@@ -219,8 +219,8 @@ class Files:
219
219
 
220
220
  @classmethod
221
221
  def list(cls, args):
222
- rsp = dashscope.File.list(page=args.start_page,
223
- page_size=args.page_size)
222
+ rsp = dashscope.Files.list(page=args.start_page,
223
+ page_size=args.page_size)
224
224
  if rsp.status_code == HTTPStatus.OK:
225
225
  if rsp.output is not None:
226
226
  for f in rsp.output['files']:
@@ -234,7 +234,7 @@ class Files:
234
234
 
235
235
  @classmethod
236
236
  def delete(cls, args):
237
- rsp = dashscope.File.delete(args.id)
237
+ rsp = dashscope.Files.delete(args.id)
238
238
  if rsp.status_code == HTTPStatus.OK:
239
239
  print('Delete success')
240
240
  else: