dashscope 1.20.3__py3-none-any.whl → 1.20.5__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/app/application.py +5 -0
- dashscope/utils/oss_utils.py +34 -43
- dashscope/version.py +1 -1
- {dashscope-1.20.3.dist-info → dashscope-1.20.5.dist-info}/METADATA +1 -1
- {dashscope-1.20.3.dist-info → dashscope-1.20.5.dist-info}/RECORD +9 -9
- {dashscope-1.20.3.dist-info → dashscope-1.20.5.dist-info}/LICENSE +0 -0
- {dashscope-1.20.3.dist-info → dashscope-1.20.5.dist-info}/WHEEL +0 -0
- {dashscope-1.20.3.dist-info → dashscope-1.20.5.dist-info}/entry_points.txt +0 -0
- {dashscope-1.20.3.dist-info → dashscope-1.20.5.dist-info}/top_level.txt +0 -0
dashscope/app/application.py
CHANGED
|
@@ -98,6 +98,7 @@ class Application(BaseApi):
|
|
|
98
98
|
doc_reference_type(str, `optional`): The type of doc reference.
|
|
99
99
|
simple: simple format of doc retrival which not include index in response text but in doc reference list.
|
|
100
100
|
indexed: include both index in response text and doc reference list
|
|
101
|
+
memory_id(str, `optional`): Used to store long term context summary between end users and assistant.
|
|
101
102
|
Raises:
|
|
102
103
|
InvalidInput: The history and auto_history are mutually exclusive.
|
|
103
104
|
|
|
@@ -160,6 +161,10 @@ class Application(BaseApi):
|
|
|
160
161
|
else:
|
|
161
162
|
raise InvalidInput('doc_tag_codes is not a List[str]')
|
|
162
163
|
|
|
164
|
+
memory_id = kwargs.pop('memory_id', None)
|
|
165
|
+
if memory_id is not None:
|
|
166
|
+
input_param['memory_id'] = memory_id
|
|
167
|
+
|
|
163
168
|
biz_params = kwargs.pop('biz_params', None)
|
|
164
169
|
if biz_params is not None and biz_params:
|
|
165
170
|
input_param['biz_params'] = biz_params
|
dashscope/utils/oss_utils.py
CHANGED
|
@@ -11,10 +11,7 @@ import requests
|
|
|
11
11
|
|
|
12
12
|
from dashscope.api_entities.dashscope_response import DashScopeAPIResponse
|
|
13
13
|
from dashscope.client.base_api import GetMixin
|
|
14
|
-
from dashscope.common.constants import
|
|
15
|
-
REQUEST_CONTENT_AUDIO,
|
|
16
|
-
REQUEST_CONTENT_IMAGE,
|
|
17
|
-
REQUEST_CONTENT_TEXT)
|
|
14
|
+
from dashscope.common.constants import FILE_PATH_SCHEMA
|
|
18
15
|
from dashscope.common.error import InvalidInput, UploadFileException
|
|
19
16
|
from dashscope.common.logging import logger
|
|
20
17
|
from dashscope.common.utils import get_user_agent
|
|
@@ -124,49 +121,43 @@ def upload_file(model: str, upload_path: str, api_key: str):
|
|
|
124
121
|
return None
|
|
125
122
|
|
|
126
123
|
|
|
127
|
-
def check_and_upload(model, elem: dict,
|
|
124
|
+
def check_and_upload(model, elem: dict, api_key):
|
|
128
125
|
is_upload = False
|
|
129
|
-
content
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
126
|
+
for key, content in elem.items():
|
|
127
|
+
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
|
|
157
157
|
|
|
158
158
|
return is_upload
|
|
159
159
|
|
|
160
160
|
|
|
161
161
|
def preprocess_message_element(model: str, elem: List[dict], api_key: str):
|
|
162
|
-
is_upload =
|
|
163
|
-
if REQUEST_CONTENT_TEXT in elem:
|
|
164
|
-
is_upload = check_and_upload(model, elem, REQUEST_CONTENT_TEXT,
|
|
165
|
-
api_key)
|
|
166
|
-
elif REQUEST_CONTENT_IMAGE in elem:
|
|
167
|
-
is_upload = check_and_upload(model, elem, REQUEST_CONTENT_IMAGE,
|
|
168
|
-
api_key)
|
|
169
|
-
elif REQUEST_CONTENT_AUDIO in elem:
|
|
170
|
-
is_upload = check_and_upload(model, elem, REQUEST_CONTENT_AUDIO,
|
|
171
|
-
api_key)
|
|
162
|
+
is_upload = check_and_upload(model, elem, api_key)
|
|
172
163
|
return is_upload
|
dashscope/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '1.20.
|
|
1
|
+
__version__ = '1.20.5'
|
|
@@ -6,7 +6,7 @@ dashscope/files.py,sha256=QgJjwhtn9F548nCA8jD8OvE6aQEj-20hZqJgYXsUdQU,3930
|
|
|
6
6
|
dashscope/finetune.py,sha256=_tflDUvu0KagSoCzLaf0hofpG_P8NU6PylL8CPjVhrA,6243
|
|
7
7
|
dashscope/model.py,sha256=UPOn1qMYFhX-ovXi3BMxZEBk8qOK7WLJOYHMbPZwYBo,1440
|
|
8
8
|
dashscope/models.py,sha256=1-bc-Ue68zurgu_y6RhfFr9uzeQMF5AZq-C32lJGMGU,1224
|
|
9
|
-
dashscope/version.py,sha256=
|
|
9
|
+
dashscope/version.py,sha256=pNM937R6vsMIEcIIPP3G1CW8_TVVSccdHb2R9-QGj8w,23
|
|
10
10
|
dashscope/aigc/__init__.py,sha256=s-MCA87KYiVumYtKtJi5IMN7xelSF6TqEU3s3_7RF-Y,327
|
|
11
11
|
dashscope/aigc/code_generation.py,sha256=KAJVrGp6tiNFBBg64Ovs9RfcP5SrIhrbW3wdA89NKso,10885
|
|
12
12
|
dashscope/aigc/conversation.py,sha256=xRoJlCR-IXHjSdkDrK74a9ut1FJg0FZhTNXZAJC18MA,14231
|
|
@@ -22,7 +22,7 @@ dashscope/api_entities/dashscope_response.py,sha256=Bp1T7HwVlkOvpMNg-AEjz-BScxhL
|
|
|
22
22
|
dashscope/api_entities/http_request.py,sha256=pYE8qRMu9CaQDiugPlXeYoaj_diBv-ZDExCD3WNhehI,13259
|
|
23
23
|
dashscope/api_entities/websocket_request.py,sha256=Xr6IJ9WqrIw5ouBQLpgoRSwL1C09jkb4u1EZdxhVQy0,15039
|
|
24
24
|
dashscope/app/__init__.py,sha256=UiN_9i--z84Dw5wUehOh_Tkk_9Gq_td_Kbz1dobBEKg,62
|
|
25
|
-
dashscope/app/application.py,sha256=
|
|
25
|
+
dashscope/app/application.py,sha256=uIWVEupscDGpUl7t6b8JZeTTlCaCQA1bznI_QdxNrj8,8200
|
|
26
26
|
dashscope/app/application_response.py,sha256=U5I8Yb1IlXzj2L5a1OAl55i0MCB3kG9Qp4aY17_73pI,6886
|
|
27
27
|
dashscope/assistants/__init__.py,sha256=i9N5OxHgY7edlOhTdPyC0N5Uc0uMCkB2vbMPDCD1zX0,383
|
|
28
28
|
dashscope/assistants/assistant_types.py,sha256=1jNL30TOlrkiYhvCaB3E8jkPLG8CnQ6I3tHpYXZCsD0,4211
|
|
@@ -81,10 +81,10 @@ dashscope/tokenizers/tokenization.py,sha256=G6cSEmVLr3pjXUC3EOU9ot8MYxNnOQ4wOB2m
|
|
|
81
81
|
dashscope/tokenizers/tokenizer.py,sha256=y6P91qTCYo__pEx_0VHAcj9YECfbUdRqZU1fdGTjF4o,1154
|
|
82
82
|
dashscope/tokenizers/tokenizer_base.py,sha256=REDhzRyDT13iequ61-a6_KcTy0GFKlihQve5HkyoyRs,656
|
|
83
83
|
dashscope/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
84
|
-
dashscope/utils/oss_utils.py,sha256=
|
|
85
|
-
dashscope-1.20.
|
|
86
|
-
dashscope-1.20.
|
|
87
|
-
dashscope-1.20.
|
|
88
|
-
dashscope-1.20.
|
|
89
|
-
dashscope-1.20.
|
|
90
|
-
dashscope-1.20.
|
|
84
|
+
dashscope/utils/oss_utils.py,sha256=zxe2NtIwcVWclVM24Ls0Flnkl66NMsUpr7TnH_6w5hs,6693
|
|
85
|
+
dashscope-1.20.5.dist-info/LICENSE,sha256=Izp5L1DF1Mbza6qojkqNNWlE_mYLnr4rmzx2EBF8YFw,11413
|
|
86
|
+
dashscope-1.20.5.dist-info/METADATA,sha256=HIqVK1zeeROG05EJAjFAmRbyUuynyWGydEVXYVv4jHM,6641
|
|
87
|
+
dashscope-1.20.5.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
|
88
|
+
dashscope-1.20.5.dist-info/entry_points.txt,sha256=raEp5dOuj8whJ7yqZlDM8WQ5p2RfnGrGNo0QLQEnatY,50
|
|
89
|
+
dashscope-1.20.5.dist-info/top_level.txt,sha256=woqavFJK9zas5xTqynmALqOtlafghjsk63Xk86powTU,10
|
|
90
|
+
dashscope-1.20.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|