dashscope 1.13.0__py3-none-any.whl → 1.13.1__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/aigc/multimodal_conversation.py +4 -2
- dashscope/utils/oss_utils.py +5 -1
- dashscope/version.py +1 -1
- {dashscope-1.13.0.dist-info → dashscope-1.13.1.dist-info}/METADATA +1 -1
- {dashscope-1.13.0.dist-info → dashscope-1.13.1.dist-info}/RECORD +9 -9
- {dashscope-1.13.0.dist-info → dashscope-1.13.1.dist-info}/LICENSE +0 -0
- {dashscope-1.13.0.dist-info → dashscope-1.13.1.dist-info}/WHEEL +0 -0
- {dashscope-1.13.0.dist-info → dashscope-1.13.1.dist-info}/entry_points.txt +0 -0
- {dashscope-1.13.0.dist-info → dashscope-1.13.1.dist-info}/top_level.txt +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import copy
|
|
1
2
|
from typing import Generator, List, Union
|
|
2
3
|
|
|
3
4
|
from dashscope.api_entities.dashscope_response import \
|
|
@@ -78,12 +79,13 @@ class MultiModalConversation(BaseApi):
|
|
|
78
79
|
if model is None or not model:
|
|
79
80
|
raise ModelRequired('Model is required!')
|
|
80
81
|
task_group, _ = _get_task_group_and_task(__name__)
|
|
81
|
-
|
|
82
|
+
msg_copy = copy.deepcopy(messages)
|
|
83
|
+
has_upload = cls._preprocess_messages(model, msg_copy, api_key)
|
|
82
84
|
if has_upload:
|
|
83
85
|
headers = kwargs.pop('headers', {})
|
|
84
86
|
headers['X-DashScope-OssResourceResolve'] = 'enable'
|
|
85
87
|
kwargs['headers'] = headers
|
|
86
|
-
input = {'messages':
|
|
88
|
+
input = {'messages': msg_copy}
|
|
87
89
|
response = super().call(model=model,
|
|
88
90
|
task_group=task_group,
|
|
89
91
|
task=MultiModalConversation.task,
|
dashscope/utils/oss_utils.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import mimetypes
|
|
1
2
|
import os
|
|
2
3
|
from datetime import datetime
|
|
3
4
|
from http import HTTPStatus
|
|
@@ -13,7 +14,7 @@ from dashscope.common.constants import (FILE_PATH_SCHEMA,
|
|
|
13
14
|
REQUEST_CONTENT_AUDIO,
|
|
14
15
|
REQUEST_CONTENT_IMAGE,
|
|
15
16
|
REQUEST_CONTENT_TEXT)
|
|
16
|
-
from dashscope.common.error import UploadFileException
|
|
17
|
+
from dashscope.common.error import InvalidInput, UploadFileException
|
|
17
18
|
from dashscope.common.logging import logger
|
|
18
19
|
from dashscope.common.utils import get_user_agent
|
|
19
20
|
|
|
@@ -64,6 +65,7 @@ class OssUtils(GetMixin):
|
|
|
64
65
|
form_data['x-oss-forbid-overwrite'] = upload_info[
|
|
65
66
|
'x_oss_forbid_overwrite']
|
|
66
67
|
form_data['success_action_status'] = '200'
|
|
68
|
+
form_data['x-oss-content-type'] = mimetypes.guess_type(file_path)[0]
|
|
67
69
|
url = upload_info['upload_host']
|
|
68
70
|
files = {'file': open(file_path, 'rb')}
|
|
69
71
|
with requests.Session() as session:
|
|
@@ -112,6 +114,8 @@ def check_and_upload(model, elem: dict, key: str, api_key):
|
|
|
112
114
|
content)
|
|
113
115
|
elem[key] = file_url
|
|
114
116
|
is_upload = True
|
|
117
|
+
else:
|
|
118
|
+
raise InvalidInput('The file: %s is not exists!' % file_path)
|
|
115
119
|
return is_upload
|
|
116
120
|
|
|
117
121
|
|
dashscope/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '1.13.
|
|
1
|
+
__version__ = '1.13.1'
|
|
@@ -4,13 +4,13 @@ dashscope/deployment.py,sha256=uhlQYOiu1baMQxQnFmRwI6ces0I-_DKp8uej_L0v1eY,4400
|
|
|
4
4
|
dashscope/file.py,sha256=Dv2Fz3DLbcye2uuQxyQwRM7ky27OthouLXIpSQagQy4,3324
|
|
5
5
|
dashscope/finetune.py,sha256=5QlIcnFCfSjN3gn9A2FO0kLUDa9Rx_jSc44ezT3aBEo,5118
|
|
6
6
|
dashscope/model.py,sha256=iuIfal-vOo0yav0HXPdA7f93vd5JNTGIAdCG_WIYkW8,1158
|
|
7
|
-
dashscope/version.py,sha256=
|
|
7
|
+
dashscope/version.py,sha256=AWOJJXuaKFwrwxYimWHjFlOhtOJuGrGuiJ0JN7ehebE,23
|
|
8
8
|
dashscope/aigc/__init__.py,sha256=s-MCA87KYiVumYtKtJi5IMN7xelSF6TqEU3s3_7RF-Y,327
|
|
9
9
|
dashscope/aigc/code_generation.py,sha256=bizJb3zGZx3pB74FKMIcnOi_6jkxpKgx__6urzqhQ_E,10627
|
|
10
10
|
dashscope/aigc/conversation.py,sha256=AU6gv52JYe8tBPZjYGJe2Aa2z50Nasb3f5Bhe4qlAGM,12022
|
|
11
11
|
dashscope/aigc/generation.py,sha256=FxEOFpgwkLLL2gLMr1YHJ0mz-jz3MKTjBN7SUBbzgxY,8157
|
|
12
12
|
dashscope/aigc/image_synthesis.py,sha256=P5KFBqYLSNrztyxdrOjpBgUDLt-o6FKVa7JyIOWxbYQ,7789
|
|
13
|
-
dashscope/aigc/multimodal_conversation.py,sha256=
|
|
13
|
+
dashscope/aigc/multimodal_conversation.py,sha256=D5JYLLxwdGsgCrYeF0gNvE1kR5Vbmq1g0MiRU-4hlZQ,5228
|
|
14
14
|
dashscope/api_entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
15
|
dashscope/api_entities/aiohttp_request.py,sha256=1WuvODWcm-merZnAFpxV2Y9QohcB3hSGS_YkwK18O7g,10359
|
|
16
16
|
dashscope/api_entities/api_request_data.py,sha256=JUMcfpJjKXEZLCBSFIDpgoaeQYk5uK9-CwhM4OHIHFQ,5463
|
|
@@ -50,10 +50,10 @@ dashscope/protocol/websocket.py,sha256=z-v6PGx3L4zYBANuC48s7SWSQSwRCDoh0zcfhv9Bf
|
|
|
50
50
|
dashscope/tokenizers/__init__.py,sha256=zRNBe3ONNOA3T2gnxhlG3PTjkVOQBUYotMMJAruyk70,71
|
|
51
51
|
dashscope/tokenizers/tokenization.py,sha256=WhSdiH0Bu-pGQCsJfC91LL_y5tVDzCtQ7tTs2Tox-HY,4543
|
|
52
52
|
dashscope/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
53
|
-
dashscope/utils/oss_utils.py,sha256=
|
|
54
|
-
dashscope-1.13.
|
|
55
|
-
dashscope-1.13.
|
|
56
|
-
dashscope-1.13.
|
|
57
|
-
dashscope-1.13.
|
|
58
|
-
dashscope-1.13.
|
|
59
|
-
dashscope-1.13.
|
|
53
|
+
dashscope/utils/oss_utils.py,sha256=arw_ZbRefOrWwzyE7l1HBz8VQcbwNfmEfJHB2-TCVp8,5330
|
|
54
|
+
dashscope-1.13.1.dist-info/LICENSE,sha256=Izp5L1DF1Mbza6qojkqNNWlE_mYLnr4rmzx2EBF8YFw,11413
|
|
55
|
+
dashscope-1.13.1.dist-info/METADATA,sha256=fbh1Abw_GJl4A36dunooOlWOPdzCMyczuZ4x-_HTMK4,7220
|
|
56
|
+
dashscope-1.13.1.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
|
57
|
+
dashscope-1.13.1.dist-info/entry_points.txt,sha256=raEp5dOuj8whJ7yqZlDM8WQ5p2RfnGrGNo0QLQEnatY,50
|
|
58
|
+
dashscope-1.13.1.dist-info/top_level.txt,sha256=woqavFJK9zas5xTqynmALqOtlafghjsk63Xk86powTU,10
|
|
59
|
+
dashscope-1.13.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|