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

dashscope/cli.py CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env python
2
2
  import argparse
3
+ import json
3
4
  import sys
4
5
  import time
5
6
  import os
@@ -216,7 +217,8 @@ class Oss:
216
217
 
217
218
  oss_url = OssUtils.upload(model=args.model,
218
219
  file_path=file_path,
219
- api_key=api_key)
220
+ api_key=api_key,
221
+ base_address=args.base_url)
220
222
 
221
223
  if not oss_url:
222
224
  print('Failed to upload file: %s' % file_path)
@@ -229,7 +231,8 @@ class Files:
229
231
  def upload(cls, args):
230
232
  rsp = dashscope.Files.upload(file_path=args.file,
231
233
  purpose=args.purpose,
232
- description=args.description)
234
+ description=args.description,
235
+ base_address=args.base_url)
233
236
  print(rsp)
234
237
  if rsp.status_code == HTTPStatus.OK:
235
238
  print('Upload success, file id: %s' %
@@ -239,32 +242,31 @@ class Files:
239
242
 
240
243
  @classmethod
241
244
  def get(cls, args):
242
- rsp = dashscope.Files.get(file_id=args.id)
245
+ rsp = dashscope.Files.get(file_id=args.id, base_address=args.base_url)
243
246
  if rsp.status_code == HTTPStatus.OK:
244
- print('file_id: %s, name: %s, description: %s' %
245
- (rsp.output['file_id'], rsp.output['name'],
246
- rsp.output['description']))
247
+ if rsp.output:
248
+ print('file info:\n%s' % json.dumps(rsp.output, ensure_ascii=False, indent=4))
249
+ else:
250
+ print('There is no uploaded file.')
247
251
  else:
248
252
  print_failed_message(rsp)
249
253
 
250
254
  @classmethod
251
255
  def list(cls, args):
252
256
  rsp = dashscope.Files.list(page=args.start_page,
253
- page_size=args.page_size)
257
+ page_size=args.page_size,
258
+ base_address=args.base_url)
254
259
  if rsp.status_code == HTTPStatus.OK:
255
- if rsp.output is not None:
256
- for f in rsp.output['files']:
257
- print('file_id: %s, name: %s, description: %s, time: %s' %
258
- (f['file_id'], f['name'], f['description'],
259
- f['gmt_create']))
260
+ if rsp.output:
261
+ print('file list info:\n%s' % json.dumps(rsp.output, ensure_ascii=False, indent=4))
260
262
  else:
261
- print('There is no uploaded file.')
263
+ print('There is no uploaded files.')
262
264
  else:
263
265
  print_failed_message(rsp)
264
266
 
265
267
  @classmethod
266
268
  def delete(cls, args):
267
- rsp = dashscope.Files.delete(args.id)
269
+ rsp = dashscope.Files.delete(args.id, base_address=args.base_url)
268
270
  if rsp.status_code == HTTPStatus.OK:
269
271
  print('Delete success')
270
272
  else:
@@ -529,6 +531,13 @@ def main():
529
531
  required=False,
530
532
  help='The dashscope api key',
531
533
  )
534
+ oss_upload.add_argument(
535
+ '-u',
536
+ '--base_url',
537
+ type=str,
538
+ help='The base url.',
539
+ required=False,
540
+ )
532
541
  oss_upload.set_defaults(func=Oss.upload)
533
542
 
534
543
  file_upload = sub_parsers.add_parser('files.upload')
@@ -555,21 +564,45 @@ def main():
555
564
  help='The file description.',
556
565
  required=False,
557
566
  )
567
+ file_upload.add_argument(
568
+ '-u',
569
+ '--base_url',
570
+ type=str,
571
+ help='The base url.',
572
+ required=False,
573
+ )
558
574
  file_upload.set_defaults(func=Files.upload)
575
+
559
576
  file_get = sub_parsers.add_parser('files.get')
560
577
  file_get.add_argument('-i',
561
578
  '--id',
562
579
  type=str,
563
580
  required=True,
564
581
  help='The file ID')
582
+ file_get.add_argument(
583
+ '-u',
584
+ '--base_url',
585
+ type=str,
586
+ help='The base url.',
587
+ required=False,
588
+ )
565
589
  file_get.set_defaults(func=Files.get)
590
+
566
591
  file_delete = sub_parsers.add_parser('files.delete')
567
592
  file_delete.add_argument('-i',
568
593
  '--id',
569
594
  type=str,
570
595
  required=True,
571
596
  help='The files ID')
597
+ file_delete.add_argument(
598
+ '-u',
599
+ '--base_url',
600
+ type=str,
601
+ help='The base url.',
602
+ required=False,
603
+ )
572
604
  file_delete.set_defaults(func=Files.delete)
605
+
573
606
  file_list = sub_parsers.add_parser('files.list')
574
607
  file_list.add_argument('-s',
575
608
  '--start_page',
@@ -581,6 +614,13 @@ def main():
581
614
  type=int,
582
615
  default=10,
583
616
  help='The page size, default 10')
617
+ file_list.add_argument(
618
+ '-u',
619
+ '--base_url',
620
+ type=str,
621
+ help='The base url.',
622
+ required=False,
623
+ )
584
624
  file_list.set_defaults(func=Files.list)
585
625
 
586
626
  deployments_call = sub_parsers.add_parser('deployments.call')
@@ -47,7 +47,7 @@ class OssUtils(GetMixin):
47
47
  Returns:
48
48
  DashScopeAPIResponse: The upload information
49
49
  """
50
- upload_info = cls.get_upload_certificate(model=model, api_key=api_key)
50
+ upload_info = cls.get_upload_certificate(model=model, api_key=api_key, **kwargs)
51
51
  if upload_info.status_code != HTTPStatus.OK:
52
52
  raise UploadFileException(
53
53
  'Get upload certificate failed, code: %s, message: %s' %
dashscope/version.py CHANGED
@@ -1,3 +1,3 @@
1
1
  # Copyright (c) Alibaba, Inc. and its affiliates.
2
2
 
3
- __version__ = '1.24.1'
3
+ __version__ = '1.24.2'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dashscope
3
- Version: 1.24.1
3
+ Version: 1.24.2
4
4
  Summary: dashscope client sdk library
5
5
  Home-page: https://dashscope.aliyun.com/
6
6
  Author: Alibaba Cloud
@@ -1,9 +1,9 @@
1
1
  dashscope/__init__.py,sha256=__BY0dzgFX5Bt50WL-2PJmI8EYOmnpXhABQntdqDtSM,3062
2
- dashscope/cli.py,sha256=BfABF8T7uVttfHTSCqGiIcA_XuiYUfCnQ9WLvSUV0Ys,25646
2
+ 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=nxaFMFG8XljEkSkDtFtMZoYaJS2vs0B00JCGab12YHI,74
6
+ dashscope/version.py,sha256=tFrHRbI2SJLqcZ_I7s27rempXOnJ1PnfN0UpyIemTGE,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
@@ -98,10 +98,10 @@ dashscope/tokenizers/tokenization.py,sha256=ubQBJ_yw_MoHuHxZcK9NarZSSbyExloeSOLI
98
98
  dashscope/tokenizers/tokenizer.py,sha256=3FQVDvMNkCW9ccYeJdjrd_PIMMD3Xv7aNZkaYOE4XX4,1205
99
99
  dashscope/tokenizers/tokenizer_base.py,sha256=5EJIFuizMWESEmLmbd38yJnfeHmPnzZPwsO4aOGjpl4,707
100
100
  dashscope/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
101
- dashscope/utils/oss_utils.py,sha256=VHdHBVYNmWEWS2Kgz_2xMwCtqJqDVjWb5logIkESBsA,7497
102
- dashscope-1.24.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
103
- dashscope-1.24.1.dist-info/METADATA,sha256=2bnSvO77hyC19Y8iu_nSz9CB_yocV6f1ksqYMqbdLgE,7123
104
- dashscope-1.24.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
105
- dashscope-1.24.1.dist-info/entry_points.txt,sha256=e9C3sOf9zDYL0O5ROEGX6FT8w-QK_kaGRWmPZDHAFys,49
106
- dashscope-1.24.1.dist-info/top_level.txt,sha256=woqavFJK9zas5xTqynmALqOtlafghjsk63Xk86powTU,10
107
- dashscope-1.24.1.dist-info/RECORD,,
101
+ dashscope/utils/oss_utils.py,sha256=0BrMogT1PgNAWLYx947akgw_lcLsaVIIMAL1KUtaB88,7507
102
+ dashscope-1.24.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
103
+ dashscope-1.24.2.dist-info/METADATA,sha256=W7cXJ-appClSQXDftF5s2agUBHZHKaqrfPZ_oKZ35N4,7123
104
+ dashscope-1.24.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
105
+ dashscope-1.24.2.dist-info/entry_points.txt,sha256=e9C3sOf9zDYL0O5ROEGX6FT8w-QK_kaGRWmPZDHAFys,49
106
+ dashscope-1.24.2.dist-info/top_level.txt,sha256=woqavFJK9zas5xTqynmALqOtlafghjsk63Xk86powTU,10
107
+ dashscope-1.24.2.dist-info/RECORD,,