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

@@ -124,36 +124,42 @@ def upload_file(model: str, upload_path: str, api_key: str):
124
124
  def check_and_upload(model, elem: dict, api_key):
125
125
  is_upload = False
126
126
  for key, content in elem.items():
127
+ # support video:[images] for qwen2-vl
128
+ is_list = isinstance(content, list)
129
+ contents = content if is_list else [content]
130
+
127
131
  if key in ['image', 'video', 'audio', 'text']:
128
- if content.startswith(FILE_PATH_SCHEMA):
129
- parse_result = urlparse(content)
130
- if parse_result.netloc:
131
- file_path = parse_result.netloc + unquote_plus(
132
- parse_result.path)
133
- else:
134
- file_path = unquote_plus(parse_result.path)
135
- if os.path.exists(file_path):
136
- file_url = OssUtils.upload(model=model,
137
- file_path=file_path,
138
- api_key=api_key)
139
- if file_url is None:
140
- raise UploadFileException('Uploading file: %s failed' %
141
- content)
142
- elem[key] = file_url
143
- is_upload = True
144
- else:
145
- raise InvalidInput('The file: %s is not exists!' %
146
- file_path)
147
- elif not content.startswith('http'):
148
- if os.path.exists(content):
149
- file_url = OssUtils.upload(model=model,
150
- file_path=content,
151
- api_key=api_key)
152
- if file_url is None:
153
- raise UploadFileException('Uploading file: %s failed' %
154
- content)
155
- elem[key] = file_url
156
- is_upload = True
132
+ for i, content in enumerate(contents):
133
+ if content.startswith(FILE_PATH_SCHEMA):
134
+ parse_result = urlparse(content)
135
+ if parse_result.netloc:
136
+ file_path = parse_result.netloc + unquote_plus(
137
+ parse_result.path)
138
+ else:
139
+ file_path = unquote_plus(parse_result.path)
140
+ if os.path.exists(file_path):
141
+ file_url = OssUtils.upload(model=model,
142
+ file_path=file_path,
143
+ api_key=api_key)
144
+ if file_url is None:
145
+ raise UploadFileException(
146
+ 'Uploading file: %s failed' % content)
147
+ contents[i] = file_url
148
+ is_upload = True
149
+ else:
150
+ raise InvalidInput('The file: %s is not exists!' %
151
+ file_path)
152
+ elif not content.startswith('http'):
153
+ if os.path.exists(content):
154
+ file_url = OssUtils.upload(model=model,
155
+ file_path=content,
156
+ api_key=api_key)
157
+ if file_url is None:
158
+ raise UploadFileException(
159
+ 'Uploading file: %s failed' % content)
160
+ contents[i] = file_url
161
+ is_upload = True
162
+ elem[key] = contents if is_list else contents[0]
157
163
 
158
164
  return is_upload
159
165
 
dashscope/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '1.20.6'
1
+ __version__ = '1.20.8'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dashscope
3
- Version: 1.20.6
3
+ Version: 1.20.8
4
4
  Summary: dashscope client sdk library
5
5
  Home-page: https://dashscope.aliyun.com/
6
6
  Author: Alibaba Cloud
@@ -18,7 +18,6 @@ Classifier: Programming Language :: Python :: 3.10
18
18
  Classifier: Programming Language :: Python :: 3.11
19
19
  Requires-Python: >=3.8.0
20
20
  Description-Content-Type: text/markdown
21
- License-File: LICENSE
22
21
  Requires-Dist: aiohttp
23
22
  Requires-Dist: requests
24
23
  Requires-Dist: websocket-client
@@ -222,3 +221,5 @@ Coming soon.
222
221
 
223
222
  ## License
224
223
  This project is licensed under the Apache License (Version 2.0).
224
+
225
+
@@ -1,9 +1,12 @@
1
1
  dashscope/__init__.py,sha256=lIBZR5fWUiO1L62J_17Gri7Dwk9kCf2xhWl8eRw8bkQ,2933
2
2
  dashscope/cli.py,sha256=amegoTkGOs6TlHMdoo4JVOqBePo3lGs745rc7leEyrE,24020
3
+ dashscope/deployment.py,sha256=ljmVi-ny6SjEs8v4oIGNWIw8UQTorE7dl5QJv7dEPIQ,5728
4
+ dashscope/file.py,sha256=Dv2Fz3DLbcye2uuQxyQwRM7ky27OthouLXIpSQagQy4,3324
3
5
  dashscope/files.py,sha256=QgJjwhtn9F548nCA8jD8OvE6aQEj-20hZqJgYXsUdQU,3930
6
+ dashscope/finetune.py,sha256=_tflDUvu0KagSoCzLaf0hofpG_P8NU6PylL8CPjVhrA,6243
4
7
  dashscope/model.py,sha256=UPOn1qMYFhX-ovXi3BMxZEBk8qOK7WLJOYHMbPZwYBo,1440
5
8
  dashscope/models.py,sha256=1-bc-Ue68zurgu_y6RhfFr9uzeQMF5AZq-C32lJGMGU,1224
6
- dashscope/version.py,sha256=6axGZRlohq7vksayxvwN9xJ80lUuSFmXPRMwGYpne_w,23
9
+ dashscope/version.py,sha256=528qtkrW31Rybnpunug78DmLVf7Ys8Mn-aRU-fFyAdA,23
7
10
  dashscope/aigc/__init__.py,sha256=s-MCA87KYiVumYtKtJi5IMN7xelSF6TqEU3s3_7RF-Y,327
8
11
  dashscope/aigc/code_generation.py,sha256=KAJVrGp6tiNFBBg64Ovs9RfcP5SrIhrbW3wdA89NKso,10885
9
12
  dashscope/aigc/conversation.py,sha256=xRoJlCR-IXHjSdkDrK74a9ut1FJg0FZhTNXZAJC18MA,14231
@@ -62,6 +65,7 @@ dashscope/protocol/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
62
65
  dashscope/protocol/websocket.py,sha256=z-v6PGx3L4zYBANuC48s7SWSQSwRCDoh0zcfhv9Bf8U,561
63
66
  dashscope/rerank/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
64
67
  dashscope/rerank/text_rerank.py,sha256=1L-RLUxMCvNhbMud1FUG6YFWT7ZV979fzhMEuVjJ1oI,2398
68
+ dashscope/resources/qwen.tiktoken,sha256=srG437XMXwJLr8NzEhxquj9m-aWgJp4kNHCh3hajMYY,2561218
65
69
  dashscope/threads/__init__.py,sha256=md5bsHekHHGOg3uQrBCk8f4BCNnA1AuI_-LDf92pNVU,621
66
70
  dashscope/threads/thread_types.py,sha256=SwAJNi-RbqFXlrztDUCt0q0MfgfJLHyYl9qWrQDmQQo,18280
67
71
  dashscope/threads/threads.py,sha256=dD72xklN71KFGBVoBVHEbCbZADwLbi9yGS9LbFpnlAI,7665
@@ -77,10 +81,10 @@ dashscope/tokenizers/tokenization.py,sha256=G6cSEmVLr3pjXUC3EOU9ot8MYxNnOQ4wOB2m
77
81
  dashscope/tokenizers/tokenizer.py,sha256=y6P91qTCYo__pEx_0VHAcj9YECfbUdRqZU1fdGTjF4o,1154
78
82
  dashscope/tokenizers/tokenizer_base.py,sha256=REDhzRyDT13iequ61-a6_KcTy0GFKlihQve5HkyoyRs,656
79
83
  dashscope/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
80
- dashscope/utils/oss_utils.py,sha256=zxe2NtIwcVWclVM24Ls0Flnkl66NMsUpr7TnH_6w5hs,6693
81
- dashscope-1.20.6.dist-info/LICENSE,sha256=Izp5L1DF1Mbza6qojkqNNWlE_mYLnr4rmzx2EBF8YFw,11413
82
- dashscope-1.20.6.dist-info/METADATA,sha256=mOswMqzMSwkTw9q8O5k_xu2OqiA5jSpJFEAMpaniIIA,6661
83
- dashscope-1.20.6.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
84
- dashscope-1.20.6.dist-info/entry_points.txt,sha256=e9C3sOf9zDYL0O5ROEGX6FT8w-QK_kaGRWmPZDHAFys,49
85
- dashscope-1.20.6.dist-info/top_level.txt,sha256=woqavFJK9zas5xTqynmALqOtlafghjsk63Xk86powTU,10
86
- dashscope-1.20.6.dist-info/RECORD,,
84
+ dashscope/utils/oss_utils.py,sha256=TSBh7MJK4ZH40Mxd8wNEsG8nQLNhQjWRjW3itHsvoZ0,7023
85
+ dashscope-1.20.8.dist-info/LICENSE,sha256=Izp5L1DF1Mbza6qojkqNNWlE_mYLnr4rmzx2EBF8YFw,11413
86
+ dashscope-1.20.8.dist-info/METADATA,sha256=M4hx1_1AZmfHDck7Aw4tYEKT4Fe3Ogf_iXFlIGU_cBc,6641
87
+ dashscope-1.20.8.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
88
+ dashscope-1.20.8.dist-info/entry_points.txt,sha256=raEp5dOuj8whJ7yqZlDM8WQ5p2RfnGrGNo0QLQEnatY,50
89
+ dashscope-1.20.8.dist-info/top_level.txt,sha256=woqavFJK9zas5xTqynmALqOtlafghjsk63Xk86powTU,10
90
+ dashscope-1.20.8.dist-info/RECORD,,
@@ -1,2 +1,3 @@
1
1
  [console_scripts]
2
2
  dashscope = dashscope.cli:main
3
+