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

@@ -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.7'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dashscope
3
- Version: 1.20.6
3
+ Version: 1.20.7
4
4
  Summary: dashscope client sdk library
5
5
  Home-page: https://dashscope.aliyun.com/
6
6
  Author: Alibaba Cloud
@@ -3,7 +3,7 @@ dashscope/cli.py,sha256=amegoTkGOs6TlHMdoo4JVOqBePo3lGs745rc7leEyrE,24020
3
3
  dashscope/files.py,sha256=QgJjwhtn9F548nCA8jD8OvE6aQEj-20hZqJgYXsUdQU,3930
4
4
  dashscope/model.py,sha256=UPOn1qMYFhX-ovXi3BMxZEBk8qOK7WLJOYHMbPZwYBo,1440
5
5
  dashscope/models.py,sha256=1-bc-Ue68zurgu_y6RhfFr9uzeQMF5AZq-C32lJGMGU,1224
6
- dashscope/version.py,sha256=6axGZRlohq7vksayxvwN9xJ80lUuSFmXPRMwGYpne_w,23
6
+ dashscope/version.py,sha256=gQu6hE6vB8heRmWsFGU7BDL4DsK0RiBB-W17n8BWDPA,23
7
7
  dashscope/aigc/__init__.py,sha256=s-MCA87KYiVumYtKtJi5IMN7xelSF6TqEU3s3_7RF-Y,327
8
8
  dashscope/aigc/code_generation.py,sha256=KAJVrGp6tiNFBBg64Ovs9RfcP5SrIhrbW3wdA89NKso,10885
9
9
  dashscope/aigc/conversation.py,sha256=xRoJlCR-IXHjSdkDrK74a9ut1FJg0FZhTNXZAJC18MA,14231
@@ -77,10 +77,10 @@ dashscope/tokenizers/tokenization.py,sha256=G6cSEmVLr3pjXUC3EOU9ot8MYxNnOQ4wOB2m
77
77
  dashscope/tokenizers/tokenizer.py,sha256=y6P91qTCYo__pEx_0VHAcj9YECfbUdRqZU1fdGTjF4o,1154
78
78
  dashscope/tokenizers/tokenizer_base.py,sha256=REDhzRyDT13iequ61-a6_KcTy0GFKlihQve5HkyoyRs,656
79
79
  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,,
80
+ dashscope/utils/oss_utils.py,sha256=TSBh7MJK4ZH40Mxd8wNEsG8nQLNhQjWRjW3itHsvoZ0,7023
81
+ dashscope-1.20.7.dist-info/LICENSE,sha256=Izp5L1DF1Mbza6qojkqNNWlE_mYLnr4rmzx2EBF8YFw,11413
82
+ dashscope-1.20.7.dist-info/METADATA,sha256=BBs0rgqbL8wqwlTSjnlM8flMtvKrjGOhiOIsjZCT-xM,6661
83
+ dashscope-1.20.7.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
84
+ dashscope-1.20.7.dist-info/entry_points.txt,sha256=e9C3sOf9zDYL0O5ROEGX6FT8w-QK_kaGRWmPZDHAFys,49
85
+ dashscope-1.20.7.dist-info/top_level.txt,sha256=woqavFJK9zas5xTqynmALqOtlafghjsk63Xk86powTU,10
86
+ dashscope-1.20.7.dist-info/RECORD,,