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.

Files changed (56) hide show
  1. dashscope/__init__.py +57 -10
  2. dashscope/aigc/code_generation.py +12 -9
  3. dashscope/aigc/conversation.py +3 -0
  4. dashscope/aigc/generation.py +3 -0
  5. dashscope/aigc/image_synthesis.py +26 -6
  6. dashscope/aigc/multimodal_conversation.py +3 -0
  7. dashscope/api_entities/aiohttp_request.py +1 -0
  8. dashscope/api_entities/api_request_factory.py +28 -12
  9. dashscope/api_entities/dashscope_response.py +63 -0
  10. dashscope/api_entities/http_request.py +21 -31
  11. dashscope/api_entities/websocket_request.py +3 -0
  12. dashscope/app/application.py +16 -18
  13. dashscope/assistants/__init__.py +14 -0
  14. dashscope/assistants/assistant_types.py +164 -0
  15. dashscope/assistants/assistants.py +280 -0
  16. dashscope/assistants/files.py +189 -0
  17. dashscope/audio/asr/asr_phrase_manager.py +27 -5
  18. dashscope/audio/asr/recognition.py +10 -2
  19. dashscope/audio/asr/transcription.py +21 -3
  20. dashscope/audio/tts/speech_synthesizer.py +3 -0
  21. dashscope/cli.py +7 -7
  22. dashscope/client/base_api.py +317 -70
  23. dashscope/common/base_type.py +130 -0
  24. dashscope/common/constants.py +1 -0
  25. dashscope/common/error.py +4 -0
  26. dashscope/common/utils.py +159 -27
  27. dashscope/deployment.py +40 -6
  28. dashscope/embeddings/batch_text_embedding.py +24 -7
  29. dashscope/embeddings/multimodal_embedding.py +3 -0
  30. dashscope/embeddings/text_embedding.py +8 -1
  31. dashscope/files.py +107 -0
  32. dashscope/finetune.py +31 -7
  33. dashscope/model.py +9 -2
  34. dashscope/models.py +47 -0
  35. dashscope/nlp/understanding.py +2 -2
  36. dashscope/rerank/__init__.py +0 -0
  37. dashscope/rerank/text_rerank.py +67 -0
  38. dashscope/threads/__init__.py +24 -0
  39. dashscope/threads/messages/__init__.py +0 -0
  40. dashscope/threads/messages/files.py +111 -0
  41. dashscope/threads/messages/messages.py +218 -0
  42. dashscope/threads/runs/__init__.py +0 -0
  43. dashscope/threads/runs/runs.py +483 -0
  44. dashscope/threads/runs/steps.py +110 -0
  45. dashscope/threads/thread_types.py +651 -0
  46. dashscope/threads/threads.py +210 -0
  47. dashscope/tokenizers/tokenization.py +3 -0
  48. dashscope/utils/oss_utils.py +11 -0
  49. dashscope/version.py +1 -1
  50. {dashscope-1.15.0.dist-info → dashscope-1.18.0.dist-info}/METADATA +2 -3
  51. dashscope-1.18.0.dist-info/RECORD +84 -0
  52. dashscope-1.15.0.dist-info/RECORD +0 -66
  53. {dashscope-1.15.0.dist-info → dashscope-1.18.0.dist-info}/LICENSE +0 -0
  54. {dashscope-1.15.0.dist-info → dashscope-1.18.0.dist-info}/WHEEL +0 -0
  55. {dashscope-1.15.0.dist-info → dashscope-1.18.0.dist-info}/entry_points.txt +0 -0
  56. {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)