dashscope 1.15.0__py3-none-any.whl → 1.18.0__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/__init__.py +57 -10
- dashscope/aigc/code_generation.py +12 -9
- dashscope/aigc/conversation.py +3 -0
- dashscope/aigc/generation.py +3 -0
- dashscope/aigc/image_synthesis.py +26 -6
- dashscope/aigc/multimodal_conversation.py +3 -0
- dashscope/api_entities/aiohttp_request.py +1 -0
- dashscope/api_entities/api_request_factory.py +28 -12
- dashscope/api_entities/dashscope_response.py +63 -0
- dashscope/api_entities/http_request.py +21 -31
- dashscope/api_entities/websocket_request.py +3 -0
- dashscope/app/application.py +16 -18
- dashscope/assistants/__init__.py +14 -0
- dashscope/assistants/assistant_types.py +164 -0
- dashscope/assistants/assistants.py +280 -0
- dashscope/assistants/files.py +189 -0
- dashscope/audio/asr/asr_phrase_manager.py +27 -5
- dashscope/audio/asr/recognition.py +10 -2
- dashscope/audio/asr/transcription.py +21 -3
- dashscope/audio/tts/speech_synthesizer.py +3 -0
- dashscope/cli.py +7 -7
- dashscope/client/base_api.py +317 -70
- dashscope/common/base_type.py +130 -0
- dashscope/common/constants.py +1 -0
- dashscope/common/error.py +4 -0
- dashscope/common/utils.py +159 -27
- dashscope/deployment.py +40 -6
- dashscope/embeddings/batch_text_embedding.py +24 -7
- dashscope/embeddings/multimodal_embedding.py +3 -0
- dashscope/embeddings/text_embedding.py +8 -1
- dashscope/files.py +107 -0
- dashscope/finetune.py +31 -7
- dashscope/model.py +9 -2
- dashscope/models.py +47 -0
- dashscope/nlp/understanding.py +2 -2
- dashscope/rerank/__init__.py +0 -0
- dashscope/rerank/text_rerank.py +67 -0
- dashscope/threads/__init__.py +24 -0
- dashscope/threads/messages/__init__.py +0 -0
- dashscope/threads/messages/files.py +111 -0
- dashscope/threads/messages/messages.py +218 -0
- dashscope/threads/runs/__init__.py +0 -0
- dashscope/threads/runs/runs.py +483 -0
- dashscope/threads/runs/steps.py +110 -0
- dashscope/threads/thread_types.py +651 -0
- dashscope/threads/threads.py +210 -0
- dashscope/tokenizers/tokenization.py +3 -0
- dashscope/utils/oss_utils.py +11 -0
- dashscope/version.py +1 -1
- {dashscope-1.15.0.dist-info → dashscope-1.18.0.dist-info}/METADATA +2 -3
- dashscope-1.18.0.dist-info/RECORD +84 -0
- dashscope-1.15.0.dist-info/RECORD +0 -66
- {dashscope-1.15.0.dist-info → dashscope-1.18.0.dist-info}/LICENSE +0 -0
- {dashscope-1.15.0.dist-info → dashscope-1.18.0.dist-info}/WHEEL +0 -0
- {dashscope-1.15.0.dist-info → dashscope-1.18.0.dist-info}/entry_points.txt +0 -0
- {dashscope-1.15.0.dist-info → dashscope-1.18.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
from dashscope.client.base_api import GetStatusMixin, ListObjectMixin
|
|
2
|
+
from dashscope.common.error import InputRequired
|
|
3
|
+
from dashscope.threads.thread_types import RunStep, RunStepList
|
|
4
|
+
|
|
5
|
+
__all__ = ['Steps']
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Steps(ListObjectMixin, GetStatusMixin):
|
|
9
|
+
SUB_PATH = 'RUNS' # useless
|
|
10
|
+
|
|
11
|
+
@classmethod
|
|
12
|
+
def list(cls,
|
|
13
|
+
run_id: str,
|
|
14
|
+
*,
|
|
15
|
+
thread_id: str,
|
|
16
|
+
limit: int = None,
|
|
17
|
+
order: str = None,
|
|
18
|
+
after: str = None,
|
|
19
|
+
before: str = None,
|
|
20
|
+
workspace: str = None,
|
|
21
|
+
api_key: str = None,
|
|
22
|
+
**kwargs) -> RunStepList:
|
|
23
|
+
"""List `RunStep` of `Run`.
|
|
24
|
+
|
|
25
|
+
Args:
|
|
26
|
+
thread_id (str): The thread id.
|
|
27
|
+
run_id (str): The run id.
|
|
28
|
+
limit (int, optional): How many assistant to retrieve. Defaults to None.
|
|
29
|
+
order (str, optional): Sort order by created_at. Defaults to None.
|
|
30
|
+
after (str, optional): Assistant id after. Defaults to None.
|
|
31
|
+
before (str, optional): Assistant id before. Defaults to None.
|
|
32
|
+
workspace (str, optional): The DashScope workspace id. Defaults to None.
|
|
33
|
+
api_key (str, optional): Your DashScope api key. Defaults to None.
|
|
34
|
+
|
|
35
|
+
Returns:
|
|
36
|
+
RunList: The list of runs.
|
|
37
|
+
"""
|
|
38
|
+
if not run_id:
|
|
39
|
+
raise InputRequired('run_id is required!')
|
|
40
|
+
response = super().list(
|
|
41
|
+
limit=limit,
|
|
42
|
+
order=order,
|
|
43
|
+
after=after,
|
|
44
|
+
before=before,
|
|
45
|
+
path=f'threads/{thread_id}/runs/{run_id}/steps',
|
|
46
|
+
workspace=workspace,
|
|
47
|
+
api_key=api_key,
|
|
48
|
+
flattened_output=True,
|
|
49
|
+
**kwargs)
|
|
50
|
+
return RunStepList(**response)
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def retrieve(cls,
|
|
54
|
+
step_id: str,
|
|
55
|
+
*,
|
|
56
|
+
thread_id: str,
|
|
57
|
+
run_id: str,
|
|
58
|
+
workspace: str = None,
|
|
59
|
+
api_key: str = None,
|
|
60
|
+
**kwargs) -> RunStep:
|
|
61
|
+
"""Retrieve the `RunStep`.
|
|
62
|
+
|
|
63
|
+
Args:
|
|
64
|
+
thread_id (str): The thread id.
|
|
65
|
+
run_id (str): The run id.
|
|
66
|
+
step_id (str): The step id.
|
|
67
|
+
workspace (str): The dashscope workspace id.
|
|
68
|
+
api_key (str, optional): The api key. Defaults to None.
|
|
69
|
+
|
|
70
|
+
Returns:
|
|
71
|
+
RunStep: The `RunStep` object.
|
|
72
|
+
"""
|
|
73
|
+
if not thread_id or not run_id or not step_id:
|
|
74
|
+
raise InputRequired('thread_id, run_id and step_id are required!')
|
|
75
|
+
response = super().get(
|
|
76
|
+
run_id,
|
|
77
|
+
path=f'threads/{thread_id}/runs/{run_id}/steps/{step_id}',
|
|
78
|
+
workspace=workspace,
|
|
79
|
+
api_key=api_key,
|
|
80
|
+
flattened_output=True,
|
|
81
|
+
**kwargs)
|
|
82
|
+
return RunStep(**response)
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def get(cls,
|
|
86
|
+
step_id: str,
|
|
87
|
+
*,
|
|
88
|
+
thread_id: str,
|
|
89
|
+
run_id: str,
|
|
90
|
+
workspace: str = None,
|
|
91
|
+
api_key: str = None,
|
|
92
|
+
**kwargs) -> RunStep:
|
|
93
|
+
"""Retrieve the `RunStep`.
|
|
94
|
+
|
|
95
|
+
Args:
|
|
96
|
+
thread_id (str): The thread id.
|
|
97
|
+
run_id (str): The run id.
|
|
98
|
+
step_id (str): The step id.
|
|
99
|
+
workspace (str): The dashscope workspace id.
|
|
100
|
+
api_key (str, optional): The api key. Defaults to None.
|
|
101
|
+
|
|
102
|
+
Returns:
|
|
103
|
+
RunStep: The `RunStep` object.
|
|
104
|
+
"""
|
|
105
|
+
return cls.retrieve(thread_id,
|
|
106
|
+
run_id,
|
|
107
|
+
step_id,
|
|
108
|
+
workspace=workspace,
|
|
109
|
+
api_key=api_key,
|
|
110
|
+
**kwargs)
|