dashscope 1.8.0__py3-none-any.whl → 1.25.6__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.
Files changed (110) hide show
  1. dashscope/__init__.py +61 -14
  2. dashscope/aigc/__init__.py +10 -3
  3. dashscope/aigc/chat_completion.py +282 -0
  4. dashscope/aigc/code_generation.py +145 -0
  5. dashscope/aigc/conversation.py +71 -12
  6. dashscope/aigc/generation.py +288 -16
  7. dashscope/aigc/image_synthesis.py +473 -31
  8. dashscope/aigc/multimodal_conversation.py +299 -14
  9. dashscope/aigc/video_synthesis.py +610 -0
  10. dashscope/api_entities/aiohttp_request.py +8 -5
  11. dashscope/api_entities/api_request_data.py +4 -2
  12. dashscope/api_entities/api_request_factory.py +68 -20
  13. dashscope/api_entities/base_request.py +20 -3
  14. dashscope/api_entities/chat_completion_types.py +344 -0
  15. dashscope/api_entities/dashscope_response.py +243 -15
  16. dashscope/api_entities/encryption.py +179 -0
  17. dashscope/api_entities/http_request.py +216 -62
  18. dashscope/api_entities/websocket_request.py +43 -34
  19. dashscope/app/__init__.py +5 -0
  20. dashscope/app/application.py +203 -0
  21. dashscope/app/application_response.py +246 -0
  22. dashscope/assistants/__init__.py +16 -0
  23. dashscope/assistants/assistant_types.py +175 -0
  24. dashscope/assistants/assistants.py +311 -0
  25. dashscope/assistants/files.py +197 -0
  26. dashscope/audio/__init__.py +4 -2
  27. dashscope/audio/asr/__init__.py +17 -1
  28. dashscope/audio/asr/asr_phrase_manager.py +203 -0
  29. dashscope/audio/asr/recognition.py +167 -27
  30. dashscope/audio/asr/transcription.py +107 -14
  31. dashscope/audio/asr/translation_recognizer.py +1006 -0
  32. dashscope/audio/asr/vocabulary.py +177 -0
  33. dashscope/audio/qwen_asr/__init__.py +7 -0
  34. dashscope/audio/qwen_asr/qwen_transcription.py +189 -0
  35. dashscope/audio/qwen_omni/__init__.py +11 -0
  36. dashscope/audio/qwen_omni/omni_realtime.py +524 -0
  37. dashscope/audio/qwen_tts/__init__.py +5 -0
  38. dashscope/audio/qwen_tts/speech_synthesizer.py +77 -0
  39. dashscope/audio/qwen_tts_realtime/__init__.py +10 -0
  40. dashscope/audio/qwen_tts_realtime/qwen_tts_realtime.py +355 -0
  41. dashscope/audio/tts/__init__.py +2 -0
  42. dashscope/audio/tts/speech_synthesizer.py +5 -0
  43. dashscope/audio/tts_v2/__init__.py +12 -0
  44. dashscope/audio/tts_v2/enrollment.py +179 -0
  45. dashscope/audio/tts_v2/speech_synthesizer.py +886 -0
  46. dashscope/cli.py +157 -37
  47. dashscope/client/base_api.py +652 -87
  48. dashscope/common/api_key.py +2 -0
  49. dashscope/common/base_type.py +135 -0
  50. dashscope/common/constants.py +13 -16
  51. dashscope/common/env.py +2 -0
  52. dashscope/common/error.py +58 -22
  53. dashscope/common/logging.py +2 -0
  54. dashscope/common/message_manager.py +2 -0
  55. dashscope/common/utils.py +276 -46
  56. dashscope/customize/__init__.py +0 -0
  57. dashscope/customize/customize_types.py +192 -0
  58. dashscope/customize/deployments.py +146 -0
  59. dashscope/customize/finetunes.py +234 -0
  60. dashscope/embeddings/__init__.py +5 -1
  61. dashscope/embeddings/batch_text_embedding.py +208 -0
  62. dashscope/embeddings/batch_text_embedding_response.py +65 -0
  63. dashscope/embeddings/multimodal_embedding.py +118 -10
  64. dashscope/embeddings/text_embedding.py +13 -1
  65. dashscope/{file.py → files.py} +19 -4
  66. dashscope/io/input_output.py +2 -0
  67. dashscope/model.py +11 -2
  68. dashscope/models.py +43 -0
  69. dashscope/multimodal/__init__.py +20 -0
  70. dashscope/multimodal/dialog_state.py +56 -0
  71. dashscope/multimodal/multimodal_constants.py +28 -0
  72. dashscope/multimodal/multimodal_dialog.py +648 -0
  73. dashscope/multimodal/multimodal_request_params.py +313 -0
  74. dashscope/multimodal/tingwu/__init__.py +10 -0
  75. dashscope/multimodal/tingwu/tingwu.py +80 -0
  76. dashscope/multimodal/tingwu/tingwu_realtime.py +579 -0
  77. dashscope/nlp/__init__.py +0 -0
  78. dashscope/nlp/understanding.py +64 -0
  79. dashscope/protocol/websocket.py +3 -0
  80. dashscope/rerank/__init__.py +0 -0
  81. dashscope/rerank/text_rerank.py +69 -0
  82. dashscope/resources/qwen.tiktoken +151643 -0
  83. dashscope/threads/__init__.py +26 -0
  84. dashscope/threads/messages/__init__.py +0 -0
  85. dashscope/threads/messages/files.py +113 -0
  86. dashscope/threads/messages/messages.py +220 -0
  87. dashscope/threads/runs/__init__.py +0 -0
  88. dashscope/threads/runs/runs.py +501 -0
  89. dashscope/threads/runs/steps.py +112 -0
  90. dashscope/threads/thread_types.py +665 -0
  91. dashscope/threads/threads.py +212 -0
  92. dashscope/tokenizers/__init__.py +7 -0
  93. dashscope/tokenizers/qwen_tokenizer.py +111 -0
  94. dashscope/tokenizers/tokenization.py +125 -0
  95. dashscope/tokenizers/tokenizer.py +45 -0
  96. dashscope/tokenizers/tokenizer_base.py +32 -0
  97. dashscope/utils/__init__.py +0 -0
  98. dashscope/utils/message_utils.py +838 -0
  99. dashscope/utils/oss_utils.py +243 -0
  100. dashscope/utils/param_utils.py +29 -0
  101. dashscope/version.py +3 -1
  102. {dashscope-1.8.0.dist-info → dashscope-1.25.6.dist-info}/METADATA +53 -50
  103. dashscope-1.25.6.dist-info/RECORD +112 -0
  104. {dashscope-1.8.0.dist-info → dashscope-1.25.6.dist-info}/WHEEL +1 -1
  105. {dashscope-1.8.0.dist-info → dashscope-1.25.6.dist-info}/entry_points.txt +0 -1
  106. {dashscope-1.8.0.dist-info → dashscope-1.25.6.dist-info/licenses}/LICENSE +2 -4
  107. dashscope/deployment.py +0 -129
  108. dashscope/finetune.py +0 -149
  109. dashscope-1.8.0.dist-info/RECORD +0 -49
  110. {dashscope-1.8.0.dist-info → dashscope-1.25.6.dist-info}/top_level.txt +0 -0
dashscope/deployment.py DELETED
@@ -1,129 +0,0 @@
1
- from dashscope.api_entities.dashscope_response import DashScopeAPIResponse
2
- from dashscope.client.base_api import (CreateMixin, DeleteMixin, GetMixin,
3
- ListMixin, PutMixin, StreamEventMixin)
4
-
5
-
6
- class Deployment(CreateMixin, DeleteMixin, ListMixin, GetMixin,
7
- StreamEventMixin, PutMixin):
8
- SUB_PATH = 'deployments'
9
- """Deploy a model.
10
- """
11
- @classmethod
12
- def call(cls,
13
- model: str,
14
- capacity: int,
15
- version: str = None,
16
- suffix: str = None,
17
- api_key: str = None,
18
- **kwargs) -> DashScopeAPIResponse:
19
- """Call to deployment a model service.
20
-
21
- Args:
22
- model (str): The model name.
23
- version (str, optional): The model version, unnecessary
24
- for fine-tuned model. Defaults to None.
25
- suffix (str, optional): The name suffix of the model deployment,
26
- If specified, the final model name will be model_suffix.
27
- Defaults to None.
28
- capacity (int, optional): The model service capacity.
29
- api_key (str, optional): The api-key. Defaults to None.
30
-
31
- Returns:
32
- DashScopeAPIResponse: _description_
33
- """
34
- req = {'model_name': model, 'capacity': capacity}
35
-
36
- if version is not None:
37
- req['model_version'] = version
38
- if suffix is not None:
39
- req['suffix'] = suffix
40
- return super().call(req, api_key, **kwargs)
41
-
42
- @classmethod
43
- def list(cls,
44
- page_no=1,
45
- page_size=10,
46
- api_key: str = None,
47
- **kwargs) -> DashScopeAPIResponse:
48
- """List deployments.
49
-
50
- Args:
51
- api_key (str, optional): The api api_key, if not present,
52
- will get by default rule(TODO: api key doc). Defaults to None.
53
- page_no (int, optional): Page number. Defaults to 1.
54
- page_size (int, optional): Items per page. Defaults to 10.
55
-
56
- Returns:
57
- DashScopeAPIResponse: The deployment list.
58
- """
59
- return super().list(page_no, page_size, api_key, **kwargs)
60
-
61
- @classmethod
62
- def get(cls,
63
- deployed_model: str,
64
- api_key: str = None,
65
- **kwargs) -> DashScopeAPIResponse:
66
- """Get model deployment information.
67
-
68
- Args:
69
- deployed_model (str): The deployment_id.
70
- api_key (str, optional): The api key. Defaults to None.
71
-
72
- Returns:
73
- DashScopeAPIResponse: The deployment information.
74
- """
75
- return super().get(deployed_model, api_key, **kwargs)
76
-
77
- @classmethod
78
- def delete(cls,
79
- deployment_id: str,
80
- api_key: str = None,
81
- **kwargs) -> DashScopeAPIResponse:
82
- """Delete model deployment.
83
-
84
- Args:
85
- deployment_id (str): The deployment id.
86
- api_key (str, optional): The api key. Defaults to None.
87
-
88
- Returns:
89
- DashScopeAPIResponse: The delete result.
90
- """
91
- return super().delete(deployment_id, api_key, **kwargs)
92
-
93
- @classmethod
94
- def update(cls,
95
- deployment_id: str,
96
- version: str,
97
- api_key: str = None,
98
- **kwargs) -> DashScopeAPIResponse:
99
- """Update model deployment.
100
-
101
- Args:
102
- deployment_id (str): The deployment id.
103
- version (str): The target model version.
104
- api_key (str, optional): The api key. Defaults to None.
105
-
106
- Returns:
107
- DashScopeAPIResponse: The delete result.
108
- """
109
- req = {'deployment_model': deployment_id, 'model_version': version}
110
- return super().put(deployment_id, req, api_key, **kwargs)
111
-
112
- @classmethod
113
- def scale(cls,
114
- deployment_id: str,
115
- capacity: int,
116
- api_key: str = None,
117
- **kwargs) -> DashScopeAPIResponse:
118
- """Scaling model deployment.
119
-
120
- Args:
121
- deployment_id (str): The deployment id.
122
- capacity (int): The target service capacity.
123
- api_key (str, optional): The api key. Defaults to None.
124
-
125
- Returns:
126
- DashScopeAPIResponse: The delete result.
127
- """
128
- req = {'deployed_model': deployment_id, 'capacity': capacity}
129
- return super().put(deployment_id, req, 'scale', api_key, **kwargs)
dashscope/finetune.py DELETED
@@ -1,149 +0,0 @@
1
- from typing import Union
2
-
3
- from dashscope.api_entities.dashscope_response import DashScopeAPIResponse
4
- from dashscope.client.base_api import (CancelMixin, CreateMixin, DeleteMixin,
5
- GetStatusMixin, ListMixin, LogMixin,
6
- StreamEventMixin)
7
-
8
-
9
- class FineTune(CreateMixin, CancelMixin, DeleteMixin, ListMixin,
10
- GetStatusMixin, StreamEventMixin, LogMixin):
11
- SUB_PATH = 'fine-tunes'
12
-
13
- @classmethod
14
- def call(cls,
15
- model: str,
16
- training_file_ids: Union[list, str],
17
- validation_file_ids: Union[list, str] = None,
18
- mode: str = None,
19
- hyper_parameters: dict = {},
20
- api_key: str = None,
21
- **kwargs) -> DashScopeAPIResponse:
22
- """Create fine-tune job
23
-
24
- Args:
25
- model (str): The model to be fine-tuned
26
- training_file_ids (list, str): Ids of the fine-tune training data,
27
- which can be pre-uploaded using the File API.
28
- validation_file_ids ([list,str], optional): Ids of the fine-tune
29
- validating data, which can be pre-uploaded using the File API.
30
- mode (str): The fine-tune mode, sft or efficient_sft.
31
- hyper_parameters (dict, optional): The fine-tune hyper parameters.
32
- Defaults to empty.
33
- api_key (str, optional): The api key. Defaults to None.
34
-
35
- Returns:
36
- DashScopeAPIResponse: The request result.
37
- """
38
- request = {
39
- 'model': model,
40
- 'training_file_ids': training_file_ids,
41
- 'validation_file_ids': validation_file_ids,
42
- 'hyper_parameters': hyper_parameters if hyper_parameters else {},
43
- }
44
- if mode is not None:
45
- request['training_type'] = mode
46
- return super().call(request, api_key, **kwargs)
47
-
48
- @classmethod
49
- def cancel(cls,
50
- job_id: str,
51
- api_key: str = None,
52
- **kwargs) -> DashScopeAPIResponse:
53
- """Cancel a running fine-tune job.
54
-
55
- Args:
56
- job_id (str): The fine-tune job id.
57
- api_key (str, optional): The api api_key, can be None,
58
- if None, will get by default rule(TODO: api key doc).
59
-
60
- Returns:
61
- DashScopeAPIResponse: The request result.
62
- """
63
- return super().cancel(job_id, api_key, **kwargs)
64
-
65
- @classmethod
66
- def list(cls,
67
- page=1,
68
- page_size=10,
69
- api_key: str = None,
70
- **kwargs) -> DashScopeAPIResponse:
71
- """List fine-tune job.
72
-
73
- Args:
74
- api_key (str, optional): The api key
75
- page (int, optional): Page number. Defaults to 1.
76
- page_size (int, optional): Items per page. Defaults to 10.
77
-
78
- Returns:
79
- DashScopeAPIResponse: The fine-tune jobs in the result.
80
- """
81
- return super().list(page, page_size, api_key, **kwargs)
82
-
83
- @classmethod
84
- def get(cls,
85
- job_id: str,
86
- api_key: str = None,
87
- **kwargs) -> DashScopeAPIResponse:
88
- """Get fine-tune job information.
89
-
90
- Args:
91
- job_id (str): The fine-tune job id
92
- api_key (str, optional): The api key. Defaults to None.
93
-
94
- Returns:
95
- DashScopeAPIResponse: The job info
96
- """
97
- return super().get(job_id, api_key, **kwargs)
98
-
99
- @classmethod
100
- def delete(cls,
101
- job_id: str,
102
- api_key: str = None,
103
- **kwargs) -> DashScopeAPIResponse:
104
- """Delete a fine-tune job.
105
-
106
- Args:
107
- job_id (str): The fine-tune job id.
108
- api_key (str, optional): The api key. Defaults to None.
109
-
110
- Returns:
111
- DashScopeAPIResponse: The delete result.
112
- """
113
- return super().delete(job_id, api_key, **kwargs)
114
-
115
- @classmethod
116
- def stream_events(cls,
117
- job_id: str,
118
- api_key: str = None,
119
- **kwargs) -> DashScopeAPIResponse:
120
- """Get fine-tune job events.
121
-
122
- Args:
123
- job_id (str): The fine-tune job id
124
- api_key (str, optional): the api key. Defaults to None.
125
-
126
- Returns:
127
- DashScopeAPIResponse: The job log events.
128
- """
129
- return super().stream_events(job_id, api_key, **kwargs)
130
-
131
- @classmethod
132
- def logs(cls,
133
- job_id: str,
134
- offset=1,
135
- line=1000,
136
- api_key: str = None,
137
- **kwargs) -> DashScopeAPIResponse:
138
- """Get log of the job.
139
-
140
- Args:
141
- job_id (str): The job id(used for fine-tune)
142
- offset (int, optional): start log line. Defaults to 1.
143
- line (int, optional): total line return. Defaults to 1000.
144
- api_key (str, optional): The api key. Defaults to None.
145
-
146
- Returns:
147
- DashScopeAPIResponse: The response
148
- """
149
- return super().logs(job_id, offset, line)
@@ -1,49 +0,0 @@
1
- dashscope/__init__.py,sha256=aGI7SwPHMVBmttyWuq6iPRvWsKM_WaQ65lMdK2kDSoY,1689
2
- dashscope/cli.py,sha256=30Qbd6EvbIBFtE-cPgkaTkKZzMZuyo2YPjLZQ8z9UME,22964
3
- dashscope/deployment.py,sha256=uhlQYOiu1baMQxQnFmRwI6ces0I-_DKp8uej_L0v1eY,4400
4
- dashscope/file.py,sha256=Dv2Fz3DLbcye2uuQxyQwRM7ky27OthouLXIpSQagQy4,3324
5
- dashscope/finetune.py,sha256=4ZubAL0Znt7Nmj7qwOGvXAuUSzjFd5GUFgzfREvH27c,5008
6
- dashscope/model.py,sha256=iuIfal-vOo0yav0HXPdA7f93vd5JNTGIAdCG_WIYkW8,1158
7
- dashscope/version.py,sha256=xM8KgdV4KJGZbMUy8tPzc62kL9LzIER0XAX4CTGiDFM,22
8
- dashscope/aigc/__init__.py,sha256=s-MCA87KYiVumYtKtJi5IMN7xelSF6TqEU3s3_7RF-Y,327
9
- dashscope/aigc/conversation.py,sha256=w6I49pbMfo-schgmCQbADhtk0D1ZKYFrqfgoPsfpMRA,10098
10
- dashscope/aigc/generation.py,sha256=8cUzgY6Cwt6T2YrDA4EEVABHQICxT2jCgIIfAq7lM4Y,6244
11
- dashscope/aigc/image_synthesis.py,sha256=zZhpny20azLinMhhvAgyLY4qHugtl1EEApJQ5vuHNZI,7669
12
- dashscope/aigc/multimodal_conversation.py,sha256=uK5dxIh-VFGf31FE5IADCaDEpJer-i9KLYUI3-Az-yI,4112
13
- dashscope/api_entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- dashscope/api_entities/aiohttp_request.py,sha256=1WuvODWcm-merZnAFpxV2Y9QohcB3hSGS_YkwK18O7g,10359
15
- dashscope/api_entities/api_request_data.py,sha256=HwleZWJAHD_5ufvI3mYUO-ZjZtHon4wQX_Y2mE_zqkU,5471
16
- dashscope/api_entities/api_request_factory.py,sha256=3bbRpjfhqwdjEQH_In7xV4eQyCTtKYfw0XHwKqx5gp4,4238
17
- dashscope/api_entities/base_request.py,sha256=cXUL7xqSV8wBr5d-1kx65AO3IsRR9A_ps6Lok-v-MKM,926
18
- dashscope/api_entities/dashscope_response.py,sha256=32u3C_xxMAed-idFMG1pLGJ027EeGdKFIUZyC-3_4k0,15768
19
- dashscope/api_entities/http_request.py,sha256=8bNtylkE98h1SeCrxTPow4Dqy3wPXWp9wHPdeWAIDe8,9637
20
- dashscope/api_entities/websocket_request.py,sha256=VK4488_3Qi2Rwx7i1FGb-lPu_BSNZAoedOqnHzOxTH8,15844
21
- dashscope/audio/__init__.py,sha256=vlw0TFVRdeRWfzmJxhzarVUqkMs-DZNf4GiMtm3C8XE,45
22
- dashscope/audio/asr/__init__.py,sha256=NShkWnph8E6MvyIg3pmakyVf5gDqkl7wlqz_KzMsfVc,198
23
- dashscope/audio/asr/recognition.py,sha256=1sLVo60_FNyiJEf6xAQgcD86Bn6Fg7FF74kFuOgLU9U,14280
24
- dashscope/audio/asr/transcription.py,sha256=niqgLGcvpsnv1LR2JFFinN7Gan92CJiMV_DrhfbY9e8,5103
25
- dashscope/audio/tts/__init__.py,sha256=fbnieZX9yNFNh5BsxLpLXb63jlxzxrdCJakV3ignjlQ,194
26
- dashscope/audio/tts/speech_synthesizer.py,sha256=wKcpUo6L1yc0OZUajUh0xbtYubTkm-M89IGSAyDwLBo,7425
27
- dashscope/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
- dashscope/client/base_api.py,sha256=DbGbjB4sK5gWs9dEjvv6WJXg7KxJ15CNQwcs1ZKCIJU,30884
29
- dashscope/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
- dashscope/common/api_key.py,sha256=5Stp0odL5JSuIO3qJBp23QNppuGbqhhvKPS66qbMs0I,1986
31
- dashscope/common/constants.py,sha256=wZYIAv230pz0fBqQedhTWqmvW-BpLF4y6UcI-RaBxbc,2481
32
- dashscope/common/env.py,sha256=oQOZW5JyEeTSde394un2lpDJ5RBh4fMU9hBfbtrKKkc,869
33
- dashscope/common/error.py,sha256=zbWWjgBXWFNtyVBMQpjuLhOKN4k5XlyByrHn1yWy4Qc,1592
34
- dashscope/common/logging.py,sha256=ecGxylG3bWES_Xv5-BD6ep4_0Ciu7F6ZPBjiZtu9Jx4,984
35
- dashscope/common/message_manager.py,sha256=i5149WzDk6nWmdFaHzYx4USXMBeX18GKSI-F4fLwbN0,1097
36
- dashscope/common/utils.py,sha256=TsZwq0FNswmN0HOucRBN4FQZuZrOCb-J8mLwj4U4coo,6410
37
- dashscope/embeddings/__init__.py,sha256=InVIZayFfGZq9Q13Mok6c_ocdV3PCFcbxjURBcLYMEg,69
38
- dashscope/embeddings/multimodal_embedding.py,sha256=nN4d_D7RddsRVfrdbhAvvmSzFM_9CUJz6ZvGBLFK334,2871
39
- dashscope/embeddings/text_embedding.py,sha256=nI-d4zcuZA_tpfu7ktI5SZ8V-dGngVclZwxGFAh4qmE,1666
40
- dashscope/io/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
- dashscope/io/input_output.py,sha256=iZ1X1x1btdoZK2VeC9JsKkag2eaXwqfNT3Q6SrmRi2w,3941
42
- dashscope/protocol/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
- dashscope/protocol/websocket.py,sha256=z-v6PGx3L4zYBANuC48s7SWSQSwRCDoh0zcfhv9Bf8U,561
44
- dashscope-1.8.0.dist-info/LICENSE,sha256=Izp5L1DF1Mbza6qojkqNNWlE_mYLnr4rmzx2EBF8YFw,11413
45
- dashscope-1.8.0.dist-info/METADATA,sha256=eRHE07arIdxS88lkNj99D9zVkLJSfdR4nk4fBEWpEuc,7201
46
- dashscope-1.8.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
47
- dashscope-1.8.0.dist-info/entry_points.txt,sha256=raEp5dOuj8whJ7yqZlDM8WQ5p2RfnGrGNo0QLQEnatY,50
48
- dashscope-1.8.0.dist-info/top_level.txt,sha256=woqavFJK9zas5xTqynmALqOtlafghjsk63Xk86powTU,10
49
- dashscope-1.8.0.dist-info/RECORD,,