dashscope 2.0.1__tar.gz → 2.0.3__tar.gz

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 (869) hide show
  1. dashscope-2.0.3/MANIFEST.in +8 -0
  2. dashscope-2.0.3/PKG-INFO +609 -0
  3. dashscope-2.0.3/README.md +528 -0
  4. dashscope-2.0.3/dashscope/__init__.py +283 -0
  5. dashscope-2.0.3/dashscope/__init__.pyi +749 -0
  6. dashscope-2.0.3/dashscope/_config.py +773 -0
  7. dashscope-2.0.3/dashscope/_error_registry.py +772 -0
  8. dashscope-2.0.3/dashscope/_logging.py +138 -0
  9. dashscope-2.0.3/dashscope/_quickstart.py +121 -0
  10. dashscope-2.0.3/dashscope/_shared/__init__.py +29 -0
  11. dashscope-2.0.3/dashscope/_shared/_errors.py +21 -0
  12. dashscope-2.0.3/dashscope/_shared/_sdk_ident.py +121 -0
  13. dashscope-2.0.3/dashscope/_shared/_sdk_session.py +43 -0
  14. dashscope-2.0.3/dashscope/_shared/_validation.py +64 -0
  15. dashscope-2.0.3/dashscope/acli/agent.py +1931 -0
  16. dashscope-2.0.3/dashscope/acli/cli/dispatch.py +560 -0
  17. dashscope-2.0.3/dashscope/acli/config.py +906 -0
  18. dashscope-2.0.3/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/agent.md +161 -0
  19. dashscope-2.0.3/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/api-doc.md +19 -0
  20. dashscope-2.0.3/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/cli.md +102 -0
  21. dashscope-2.0.3/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/diagnose.md +15 -0
  22. dashscope-2.0.3/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/error-code.md +77 -0
  23. dashscope-2.0.3/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/fine-tuning.md +166 -0
  24. dashscope-2.0.3/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/multimodal.md +223 -0
  25. dashscope-2.0.3/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/retrieval.md +243 -0
  26. dashscope-2.0.3/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/sdk-example.md +20 -0
  27. dashscope-2.0.3/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/speech.md +201 -0
  28. dashscope-2.0.3/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/text-generation.md +209 -0
  29. dashscope-2.0.3/dashscope/acli/examples/dashscope-sdk-expert/.acli/system-prompt.md +116 -0
  30. dashscope-2.0.3/dashscope/acli/examples/dashscope-sdk-expert/README.md +117 -0
  31. dashscope-2.0.3/dashscope/acli/providers/__init__.py +156 -0
  32. dashscope-2.0.3/dashscope/acli/runtime.py +115 -0
  33. dashscope-2.0.3/dashscope/acli/sdk.py +217 -0
  34. dashscope-2.0.3/dashscope/acli/session.py +566 -0
  35. dashscope-2.0.3/dashscope/acli/session_events.py +261 -0
  36. dashscope-2.0.3/dashscope/acli/tools/filesystem.py +437 -0
  37. dashscope-2.0.3/dashscope/acli/tools/platform.py +555 -0
  38. dashscope-2.0.3/dashscope/acli/tools/registry.py +497 -0
  39. dashscope-2.0.3/dashscope/acli/tools/session.py +412 -0
  40. dashscope-2.0.3/dashscope/acli/ui/embedded.py +131 -0
  41. dashscope-2.0.3/dashscope/acli/ui/tui.py +3182 -0
  42. dashscope-2.0.3/dashscope/applications/__init__.py +2 -0
  43. dashscope-2.0.3/dashscope/applications/agentstudio/__init__.py +164 -0
  44. dashscope-2.0.3/dashscope/applications/agentstudio/client.py +312 -0
  45. dashscope-2.0.3/dashscope/applications/agentstudio/exceptions.py +187 -0
  46. dashscope-2.0.3/dashscope/applications/agentstudio/resources/__init__.py +104 -0
  47. dashscope-2.0.3/dashscope/applications/agentstudio/resources/_helpers.py +187 -0
  48. dashscope-2.0.3/dashscope/applications/agentstudio/resources/agents.py +352 -0
  49. dashscope-2.0.3/dashscope/applications/agentstudio/resources/deployments.py +463 -0
  50. dashscope-2.0.3/dashscope/applications/agentstudio/resources/environments.py +245 -0
  51. dashscope-2.0.3/dashscope/applications/agentstudio/resources/files.py +389 -0
  52. dashscope-2.0.3/dashscope/applications/agentstudio/resources/memory_stores.py +790 -0
  53. dashscope-2.0.3/dashscope/applications/agentstudio/resources/security.py +141 -0
  54. dashscope-2.0.3/dashscope/applications/agentstudio/resources/session_events.py +419 -0
  55. dashscope-2.0.3/dashscope/applications/agentstudio/resources/session_resources.py +189 -0
  56. dashscope-2.0.3/dashscope/applications/agentstudio/resources/session_threads.py +250 -0
  57. dashscope-2.0.3/dashscope/applications/agentstudio/resources/sessions.py +316 -0
  58. dashscope-2.0.3/dashscope/applications/agentstudio/resources/skills.py +380 -0
  59. dashscope-2.0.3/dashscope/applications/agentstudio/resources/vaults.py +476 -0
  60. dashscope-2.0.3/dashscope/applications/agentstudio/resources/webhook_endpoints.py +280 -0
  61. dashscope-2.0.3/dashscope/applications/agentstudio/streaming.py +253 -0
  62. dashscope-2.0.3/dashscope/applications/agentstudio/transport.py +710 -0
  63. dashscope-2.0.3/dashscope/applications/agentstudio/types/__init__.py +134 -0
  64. dashscope-2.0.3/dashscope/applications/agentstudio/types/models.py +1621 -0
  65. dashscope-2.0.3/dashscope/applications/agentstudio/types/params.py +1091 -0
  66. dashscope-2.0.3/dashscope/applications/finetune/_submit.py +140 -0
  67. dashscope-2.0.3/dashscope/applications/finetune/agentic_rl.py +767 -0
  68. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/__init__.py +270 -0
  69. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/common/constants.py +158 -0
  70. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/common/errors.py +421 -0
  71. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/common/log.py +34 -0
  72. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/common/model.py +1955 -0
  73. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/common/utils.py +1074 -0
  74. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/__init__.py +116 -0
  75. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/data/__init__.py +64 -0
  76. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/data/base_data_model.py +232 -0
  77. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/data/group_reward_input.py +52 -0
  78. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/data/group_reward_output.py +56 -0
  79. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/data/reward_input.py +52 -0
  80. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/data/reward_output.py +70 -0
  81. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/data/rollout_input.py +77 -0
  82. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/data/rollout_output.py +55 -0
  83. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/demo/__init__.py +13 -0
  84. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/demo/group_reward_processor_demo.py +113 -0
  85. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/demo/reward_processor_demo.py +97 -0
  86. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/demo/rollout_processor_demo.py +96 -0
  87. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/func_decorator.py +226 -0
  88. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/func_manager.py +338 -0
  89. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/observability/__init__.py +122 -0
  90. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/observability/genai/__init__.py +146 -0
  91. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/observability/genai/_core.py +505 -0
  92. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/observability/genai/llm_dashscope.py +190 -0
  93. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/observability/genai/llm_openai.py +620 -0
  94. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/observability/genai/llm_span.py +237 -0
  95. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/observability/genai/messages.py +614 -0
  96. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/observability/genai/tools.py +1026 -0
  97. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/observability/processor_span.py +323 -0
  98. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/observability/tracing.py +825 -0
  99. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/parser/__init__.py +20 -0
  100. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/parser/base_parser.py +35 -0
  101. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/parser/group_reward_parser.py +41 -0
  102. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/parser/reward_parser.py +41 -0
  103. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/parser/rollout_parser.py +41 -0
  104. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/processor/__init__.py +20 -0
  105. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/processor/abstract_group_reward_processor.py +83 -0
  106. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/processor/abstract_processor.py +54 -0
  107. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/processor/abstract_reward_processor.py +201 -0
  108. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/processor/abstract_rollout_processor.py +78 -0
  109. dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/server/server.py +639 -0
  110. dashscope-2.0.3/dashscope/client.py +493 -0
  111. dashscope-2.0.3/dashscope/errors.py +613 -0
  112. dashscope-2.0.3/dashscope/legacy_1x/__init__.py +13 -0
  113. dashscope-2.0.3/dashscope/legacy_1x/_shim.py +182 -0
  114. dashscope-2.0.3/dashscope/legacy_1x/agentstudio/__init__.py +164 -0
  115. dashscope-2.0.3/dashscope/legacy_1x/agentstudio/client.py +106 -0
  116. dashscope-2.0.3/dashscope/legacy_1x/agentstudio/streaming.py +46 -0
  117. dashscope-2.0.3/dashscope/legacy_1x/agentstudio/transport.py +105 -0
  118. dashscope-2.0.3/dashscope/legacy_1x/aigc/chat_completion.py +301 -0
  119. dashscope-2.0.3/dashscope/legacy_1x/aigc/code_generation.py +178 -0
  120. dashscope-2.0.3/dashscope/legacy_1x/aigc/conversation.py +418 -0
  121. dashscope-2.0.3/dashscope/legacy_1x/aigc/generation.py +568 -0
  122. dashscope-2.0.3/dashscope/legacy_1x/aigc/image_generation.py +669 -0
  123. dashscope-2.0.3/dashscope/legacy_1x/aigc/image_synthesis.py +1097 -0
  124. dashscope-2.0.3/dashscope/legacy_1x/aigc/multimodal_conversation.py +556 -0
  125. dashscope-2.0.3/dashscope/legacy_1x/aigc/video_synthesis.py +1046 -0
  126. dashscope-2.0.3/dashscope/legacy_1x/api_entities/aio_session.py +129 -0
  127. dashscope-2.0.3/dashscope/legacy_1x/api_entities/aiohttp_request.py +333 -0
  128. dashscope-2.0.3/dashscope/legacy_1x/api_entities/api_request_data.py +170 -0
  129. dashscope-2.0.3/dashscope/legacy_1x/api_entities/api_request_factory.py +240 -0
  130. dashscope-2.0.3/dashscope/legacy_1x/api_entities/base_request.py +39 -0
  131. dashscope-2.0.3/dashscope/legacy_1x/api_entities/chat_completion_types.py +395 -0
  132. dashscope-2.0.3/dashscope/legacy_1x/api_entities/encryption.py +212 -0
  133. dashscope-2.0.3/dashscope/legacy_1x/api_entities/http_request.py +661 -0
  134. dashscope-2.0.3/dashscope/legacy_1x/api_entities/websocket_request.py +454 -0
  135. dashscope-2.0.3/dashscope/legacy_1x/app/application.py +349 -0
  136. dashscope-2.0.3/dashscope/legacy_1x/app/application_response.py +272 -0
  137. dashscope-2.0.3/dashscope/legacy_1x/assistants/__init__.py +31 -0
  138. dashscope-2.0.3/dashscope/legacy_1x/assistants/assistant_types.py +190 -0
  139. dashscope-2.0.3/dashscope/legacy_1x/assistants/assistants.py +456 -0
  140. dashscope-2.0.3/dashscope/legacy_1x/assistants/files.py +283 -0
  141. dashscope-2.0.3/dashscope/legacy_1x/audio/asr/asr_phrase_manager.py +226 -0
  142. dashscope-2.0.3/dashscope/legacy_1x/audio/asr/recognition.py +713 -0
  143. dashscope-2.0.3/dashscope/legacy_1x/audio/asr/transcription.py +261 -0
  144. dashscope-2.0.3/dashscope/legacy_1x/audio/asr/translation_recognizer.py +1184 -0
  145. dashscope-2.0.3/dashscope/legacy_1x/audio/asr/vocabulary.py +236 -0
  146. dashscope-2.0.3/dashscope/legacy_1x/audio/http_tts/__init__.py +12 -0
  147. dashscope-2.0.3/dashscope/legacy_1x/audio/http_tts/http_speech_synthesizer.py +353 -0
  148. dashscope-2.0.3/dashscope/legacy_1x/audio/qwen_asr/qwen_transcription.py +216 -0
  149. dashscope-2.0.3/dashscope/legacy_1x/audio/qwen_omni/omni_realtime.py +824 -0
  150. dashscope-2.0.3/dashscope/legacy_1x/audio/qwen_tts/speech_synthesizer.py +87 -0
  151. dashscope-2.0.3/dashscope/legacy_1x/audio/qwen_tts_realtime/qwen_tts_realtime.py +433 -0
  152. dashscope-2.0.3/dashscope/legacy_1x/audio/tts/speech_synthesizer.py +231 -0
  153. dashscope-2.0.3/dashscope/legacy_1x/audio/tts_v2/enrollment.py +246 -0
  154. dashscope-2.0.3/dashscope/legacy_1x/audio/tts_v2/speech_synthesizer.py +1177 -0
  155. dashscope-2.0.3/dashscope/legacy_1x/cli/__init__.py +591 -0
  156. dashscope-2.0.3/dashscope/legacy_1x/cli/__main__.py +17 -0
  157. dashscope-2.0.3/dashscope/legacy_1x/cli/agentic_rl.py +739 -0
  158. dashscope-2.0.3/dashscope/legacy_1x/cli/application.py +87 -0
  159. dashscope-2.0.3/dashscope/legacy_1x/cli/auth.py +121 -0
  160. dashscope-2.0.3/dashscope/legacy_1x/cli/code_generation.py +87 -0
  161. dashscope-2.0.3/dashscope/legacy_1x/cli/common.py +188 -0
  162. dashscope-2.0.3/dashscope/legacy_1x/cli/deployments.py +279 -0
  163. dashscope-2.0.3/dashscope/legacy_1x/cli/embeddings.py +79 -0
  164. dashscope-2.0.3/dashscope/legacy_1x/cli/files.py +147 -0
  165. dashscope-2.0.3/dashscope/legacy_1x/cli/fine_tunes.py +401 -0
  166. dashscope-2.0.3/dashscope/legacy_1x/cli/generation.py +245 -0
  167. dashscope-2.0.3/dashscope/legacy_1x/cli/image_generation.py +193 -0
  168. dashscope-2.0.3/dashscope/legacy_1x/cli/image_synthesis.py +177 -0
  169. dashscope-2.0.3/dashscope/legacy_1x/cli/models.py +54 -0
  170. dashscope-2.0.3/dashscope/legacy_1x/cli/multimodal_conversation.py +98 -0
  171. dashscope-2.0.3/dashscope/legacy_1x/cli/multimodal_embedding.py +126 -0
  172. dashscope-2.0.3/dashscope/legacy_1x/cli/oss.py +88 -0
  173. dashscope-2.0.3/dashscope/legacy_1x/cli/rerank.py +71 -0
  174. dashscope-2.0.3/dashscope/legacy_1x/cli/speech_synthesis.py +102 -0
  175. dashscope-2.0.3/dashscope/legacy_1x/cli/tokenization.py +54 -0
  176. dashscope-2.0.3/dashscope/legacy_1x/cli/transcription.py +211 -0
  177. dashscope-2.0.3/dashscope/legacy_1x/cli/understanding.py +61 -0
  178. dashscope-2.0.3/dashscope/legacy_1x/cli/video_synthesis.py +222 -0
  179. dashscope-2.0.3/dashscope/legacy_1x/client/base_api.py +1707 -0
  180. dashscope-2.0.3/dashscope/legacy_1x/common/_sdk_session.py +11 -0
  181. dashscope-2.0.3/dashscope/legacy_1x/common/api_key.py +55 -0
  182. dashscope-2.0.3/dashscope/legacy_1x/common/env.py +102 -0
  183. dashscope-2.0.3/dashscope/legacy_1x/common/error.py +147 -0
  184. dashscope-2.0.3/dashscope/legacy_1x/common/logging.py +33 -0
  185. dashscope-2.0.3/dashscope/legacy_1x/common/message_manager.py +38 -0
  186. dashscope-2.0.3/dashscope/legacy_1x/common/utils.py +550 -0
  187. dashscope-2.0.3/dashscope/legacy_1x/embeddings/batch_text_embedding.py +237 -0
  188. dashscope-2.0.3/dashscope/legacy_1x/embeddings/batch_text_embedding_response.py +74 -0
  189. dashscope-2.0.3/dashscope/legacy_1x/embeddings/multimodal_embedding.py +302 -0
  190. dashscope-2.0.3/dashscope/legacy_1x/embeddings/text_embedding.py +85 -0
  191. dashscope-2.0.3/dashscope/legacy_1x/files.py +138 -0
  192. dashscope-2.0.3/dashscope/legacy_1x/finetune/agentic_rl.py +326 -0
  193. dashscope-2.0.3/dashscope/legacy_1x/finetune/customize_types.py +193 -0
  194. dashscope-2.0.3/dashscope/legacy_1x/finetune/deployments.py +196 -0
  195. dashscope-2.0.3/dashscope/legacy_1x/finetune/finetunes.py +291 -0
  196. dashscope-2.0.3/dashscope/legacy_1x/finetune/reinforcement/__init__.py +51 -0
  197. dashscope-2.0.3/dashscope/legacy_1x/finetune/reinforcement/common/__init__.py +22 -0
  198. dashscope-2.0.3/dashscope/legacy_1x/finetune/reinforcement/common/errors.py +53 -0
  199. dashscope-2.0.3/dashscope/legacy_1x/io/input_output.py +132 -0
  200. dashscope-2.0.3/dashscope/legacy_1x/model.py +64 -0
  201. dashscope-2.0.3/dashscope/legacy_1x/models.py +80 -0
  202. dashscope-2.0.3/dashscope/legacy_1x/multimodal/multimodal_dialog.py +801 -0
  203. dashscope-2.0.3/dashscope/legacy_1x/multimodal/tingwu/tingwu.py +89 -0
  204. dashscope-2.0.3/dashscope/legacy_1x/multimodal/tingwu/tingwu_realtime.py +638 -0
  205. dashscope-2.0.3/dashscope/legacy_1x/nlp/understanding.py +92 -0
  206. dashscope-2.0.3/dashscope/legacy_1x/rerank/__init__.py +6 -0
  207. dashscope-2.0.3/dashscope/legacy_1x/rerank/text_rerank.py +178 -0
  208. dashscope-2.0.3/dashscope/legacy_1x/threads/__init__.py +29 -0
  209. dashscope-2.0.3/dashscope/legacy_1x/threads/messages/files.py +130 -0
  210. dashscope-2.0.3/dashscope/legacy_1x/threads/messages/messages.py +295 -0
  211. dashscope-2.0.3/dashscope/legacy_1x/threads/runs/runs.py +649 -0
  212. dashscope-2.0.3/dashscope/legacy_1x/threads/runs/steps.py +154 -0
  213. dashscope-2.0.3/dashscope/legacy_1x/threads/thread_types.py +708 -0
  214. dashscope-2.0.3/dashscope/legacy_1x/threads/threads.py +299 -0
  215. dashscope-2.0.3/dashscope/legacy_1x/tokenizers/tokenization.py +174 -0
  216. dashscope-2.0.3/dashscope/legacy_1x/tokenizers/tokenizer.py +44 -0
  217. dashscope-2.0.3/dashscope/legacy_1x/utils/oss_utils.py +314 -0
  218. dashscope-2.0.3/dashscope/protocols/__init__.py +49 -0
  219. dashscope-2.0.3/dashscope/protocols/anthropic.py +780 -0
  220. dashscope-2.0.3/dashscope/protocols/base.py +127 -0
  221. dashscope-2.0.3/dashscope/protocols/native.py +176 -0
  222. dashscope-2.0.3/dashscope/protocols/openai.py +265 -0
  223. dashscope-2.0.3/dashscope/py.typed +0 -0
  224. dashscope-2.0.3/dashscope/resources/_blocking.py +87 -0
  225. dashscope-2.0.3/dashscope/resources/_jobs.py +632 -0
  226. dashscope-2.0.3/dashscope/resources/_oss.py +228 -0
  227. dashscope-2.0.3/dashscope/resources/_oss_upload.py +241 -0
  228. dashscope-2.0.3/dashscope/resources/_sse.py +78 -0
  229. dashscope-2.0.3/dashscope/resources/apps.py +573 -0
  230. dashscope-2.0.3/dashscope/resources/audio/__init__.py +133 -0
  231. dashscope-2.0.3/dashscope/resources/audio/_callbacks.py +70 -0
  232. dashscope-2.0.3/dashscope/resources/audio/asr.py +684 -0
  233. dashscope-2.0.3/dashscope/resources/audio/customization.py +615 -0
  234. dashscope-2.0.3/dashscope/resources/audio/http_tts.py +587 -0
  235. dashscope-2.0.3/dashscope/resources/audio/phrases.py +254 -0
  236. dashscope-2.0.3/dashscope/resources/audio/realtime.py +866 -0
  237. dashscope-2.0.3/dashscope/resources/audio/tts.py +425 -0
  238. dashscope-2.0.3/dashscope/resources/chat/__init__.py +39 -0
  239. dashscope-2.0.3/dashscope/resources/chat/_params.py +21 -0
  240. dashscope-2.0.3/dashscope/resources/chat/completions.py +1045 -0
  241. dashscope-2.0.3/dashscope/resources/decision.py +287 -0
  242. dashscope-2.0.3/dashscope/resources/deployments.py +455 -0
  243. dashscope-2.0.3/dashscope/resources/embeddings.py +429 -0
  244. dashscope-2.0.3/dashscope/resources/files.py +400 -0
  245. dashscope-2.0.3/dashscope/resources/fine_tunes.py +698 -0
  246. dashscope-2.0.3/dashscope/resources/images.py +814 -0
  247. dashscope-2.0.3/dashscope/resources/models.py +229 -0
  248. dashscope-2.0.3/dashscope/resources/multimodal/__init__.py +31 -0
  249. dashscope-2.0.3/dashscope/resources/multimodal/chat.py +334 -0
  250. dashscope-2.0.3/dashscope/resources/multimodal/embeddings.py +245 -0
  251. dashscope-2.0.3/dashscope/resources/reinforcement_learning.py +863 -0
  252. dashscope-2.0.3/dashscope/resources/rerank.py +168 -0
  253. dashscope-2.0.3/dashscope/resources/tingwu.py +344 -0
  254. dashscope-2.0.3/dashscope/resources/tokenization.py +142 -0
  255. dashscope-2.0.3/dashscope/resources/videos.py +592 -0
  256. dashscope-2.0.3/dashscope/transport/__init__.py +11 -0
  257. dashscope-2.0.3/dashscope/transport/_ident.py +93 -0
  258. dashscope-2.0.3/dashscope/transport/http.py +619 -0
  259. dashscope-2.0.3/dashscope/transport/sse.py +156 -0
  260. dashscope-2.0.3/dashscope/transport/ws.py +369 -0
  261. dashscope-2.0.3/dashscope/transport/ws_connection.py +535 -0
  262. dashscope-2.0.3/dashscope/types/__init__.py +49 -0
  263. dashscope-2.0.3/dashscope/types/common.py +203 -0
  264. dashscope-2.0.3/dashscope/types/completions.py +170 -0
  265. dashscope-2.0.3/dashscope/types/messages.py +241 -0
  266. dashscope-2.0.3/dashscope/version.py +4 -0
  267. dashscope-2.0.3/dashscope.egg-info/PKG-INFO +609 -0
  268. dashscope-2.0.3/dashscope.egg-info/SOURCES.txt +580 -0
  269. dashscope-2.0.3/dashscope.egg-info/entry_points.txt +2 -0
  270. dashscope-2.0.3/dashscope.egg-info/requires.txt +54 -0
  271. dashscope-2.0.3/examples/01_atomic_capabilities/audio/asr_file.py +215 -0
  272. dashscope-2.0.3/examples/01_atomic_capabilities/audio/asr_http_stream.py +142 -0
  273. dashscope-2.0.3/examples/01_atomic_capabilities/audio/direct_call/asr_file.py +232 -0
  274. dashscope-2.0.3/examples/01_atomic_capabilities/audio/direct_call/asr_http_stream.py +153 -0
  275. dashscope-2.0.3/examples/01_atomic_capabilities/audio/direct_call/realtime_omni.py +225 -0
  276. dashscope-2.0.3/examples/01_atomic_capabilities/audio/direct_call/realtime_qwen_audio.py +222 -0
  277. dashscope-2.0.3/examples/01_atomic_capabilities/audio/direct_call/realtime_translation.py +226 -0
  278. dashscope-2.0.3/examples/01_atomic_capabilities/audio/direct_call/tts_websocket.py +197 -0
  279. dashscope-2.0.3/examples/01_atomic_capabilities/audio/direct_call/voice_clone.py +283 -0
  280. dashscope-2.0.3/examples/01_atomic_capabilities/audio/realtime_omni.py +198 -0
  281. dashscope-2.0.3/examples/01_atomic_capabilities/audio/realtime_qwen_audio.py +196 -0
  282. dashscope-2.0.3/examples/01_atomic_capabilities/audio/realtime_translation.py +200 -0
  283. dashscope-2.0.3/examples/01_atomic_capabilities/audio/tts_websocket.py +180 -0
  284. dashscope-2.0.3/examples/01_atomic_capabilities/audio/voice_clone.py +277 -0
  285. dashscope-2.0.3/examples/01_atomic_capabilities/decision/decision.py +107 -0
  286. dashscope-2.0.3/examples/02_advanced_engineering/circuit_breaker_retry.py +217 -0
  287. dashscope-2.0.3/examples/02_advanced_engineering/local_mock_debugging.py +116 -0
  288. dashscope-2.0.3/examples/03_agent_recipes/agentstudio.py +145 -0
  289. dashscope-2.0.3/examples/04_real_world_scenarios/README.md +192 -0
  290. dashscope-2.0.3/examples/04_real_world_scenarios/README_zh.md +192 -0
  291. dashscope-2.0.3/examples/04_real_world_scenarios/production_ready_rag_harness.py +717 -0
  292. dashscope-2.0.3/examples/04_real_world_scenarios/realtime_audio_meeting_harness.py +541 -0
  293. dashscope-2.0.3/examples/04_real_world_scenarios/ticket_triage_harness.py +493 -0
  294. dashscope-2.0.3/examples/README.md +159 -0
  295. dashscope-2.0.3/examples/README_zh.md +159 -0
  296. dashscope-2.0.3/examples/legacy_1x/aio_generation/basic.py +48 -0
  297. dashscope-2.0.3/examples/legacy_1x/aio_generation/custom_session.py +96 -0
  298. dashscope-2.0.3/examples/legacy_1x/aio_generation/deep_research.py +165 -0
  299. dashscope-2.0.3/examples/legacy_1x/aio_generation/reasoning.py +46 -0
  300. dashscope-2.0.3/examples/legacy_1x/aio_generation/tool_calls.py +74 -0
  301. dashscope-2.0.3/examples/legacy_1x/aio_image_synthesis.py +84 -0
  302. dashscope-2.0.3/examples/legacy_1x/aio_video_synthesis.py +74 -0
  303. dashscope-2.0.3/examples/legacy_1x/assistant_api_file.py +31 -0
  304. dashscope-2.0.3/examples/legacy_1x/cv_models.py +50 -0
  305. dashscope-2.0.3/examples/legacy_1x/image_generation.py +103 -0
  306. dashscope-2.0.3/examples/legacy_1x/set_region_example.py +126 -0
  307. dashscope-2.0.3/examples/legacy_1x/tingwu_realtime.py +150 -0
  308. dashscope-2.0.3/examples/legacy_1x/tingwu_usages.py +28 -0
  309. dashscope-2.0.3/requirements.txt +18 -0
  310. dashscope-2.0.3/setup.py +147 -0
  311. dashscope-2.0.3/tests/test_agentstudio_errors.py +577 -0
  312. dashscope-2.0.3/tests/test_agentstudio_models.py +325 -0
  313. dashscope-2.0.3/tests/test_agentstudio_protocol.py +1489 -0
  314. dashscope-2.0.3/tests/test_agentstudio_shim.py +290 -0
  315. dashscope-2.0.3/tests/test_apps.py +471 -0
  316. dashscope-2.0.3/tests/test_audio.py +1172 -0
  317. dashscope-2.0.3/tests/test_audio_connection.py +555 -0
  318. dashscope-2.0.3/tests/test_audio_management.py +1101 -0
  319. dashscope-2.0.3/tests/test_audio_omni_session.py +3120 -0
  320. dashscope-2.0.3/tests/test_audio_samples.py +1579 -0
  321. dashscope-2.0.3/tests/test_audio_samples_direct_call.py +685 -0
  322. dashscope-2.0.3/tests/test_audio_tts_http.py +1139 -0
  323. dashscope-2.0.3/tests/test_audio_tts_realtime.py +509 -0
  324. dashscope-2.0.3/tests/test_audio_tts_session.py +538 -0
  325. dashscope-2.0.3/tests/test_audio_ws_integration.py +1579 -0
  326. dashscope-2.0.3/tests/test_base_url_routing.py +240 -0
  327. dashscope-2.0.3/tests/test_chat.py +1656 -0
  328. dashscope-2.0.3/tests/test_chat_params.py +46 -0
  329. dashscope-2.0.3/tests/test_config.py +660 -0
  330. dashscope-2.0.3/tests/test_decision.py +558 -0
  331. dashscope-2.0.3/tests/test_error_registry.py +361 -0
  332. dashscope-2.0.3/tests/test_errors.py +1010 -0
  333. dashscope-2.0.3/tests/test_files_models.py +544 -0
  334. dashscope-2.0.3/tests/test_finetune_deployments.py +1075 -0
  335. dashscope-2.0.3/tests/test_finetune_rl_shim.py +460 -0
  336. dashscope-2.0.3/tests/test_http_pool.py +134 -0
  337. dashscope-2.0.3/tests/test_images_videos.py +697 -0
  338. dashscope-2.0.3/tests/test_jobs.py +977 -0
  339. dashscope-2.0.3/tests/test_legacy_import_aliases.py +212 -0
  340. dashscope-2.0.3/tests/test_logging.py +199 -0
  341. dashscope-2.0.3/tests/test_multimodal.py +591 -0
  342. dashscope-2.0.3/tests/test_oss_upload.py +422 -0
  343. dashscope-2.0.3/tests/test_package_root.py +207 -0
  344. dashscope-2.0.3/tests/test_protocols.py +1882 -0
  345. dashscope-2.0.3/tests/test_rl.py +807 -0
  346. dashscope-2.0.3/tests/test_settings.py +227 -0
  347. dashscope-2.0.3/tests/test_sse.py +636 -0
  348. dashscope-2.0.3/tests/test_sse_comprehensive_verify.py +419 -0
  349. dashscope-2.0.3/tests/test_tingwu.py +365 -0
  350. dashscope-2.0.3/tests/test_tools_resources.py +605 -0
  351. dashscope-2.0.3/tests/test_transport.py +871 -0
  352. dashscope-2.0.3/tests/test_types_messages.py +358 -0
  353. dashscope-2.0.3/tests/test_ws_connection.py +958 -0
  354. dashscope-2.0.1/MANIFEST.in +0 -8
  355. dashscope-2.0.1/PKG-INFO +0 -532
  356. dashscope-2.0.1/README.md +0 -452
  357. dashscope-2.0.1/dashscope/__init__.py +0 -226
  358. dashscope-2.0.1/dashscope/__init__.pyi +0 -716
  359. dashscope-2.0.1/dashscope/acli/agent.py +0 -1908
  360. dashscope-2.0.1/dashscope/acli/cli/dispatch.py +0 -557
  361. dashscope-2.0.1/dashscope/acli/config.py +0 -908
  362. dashscope-2.0.1/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/agent.md +0 -102
  363. dashscope-2.0.1/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/api-doc.md +0 -14
  364. dashscope-2.0.1/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/cli.md +0 -98
  365. dashscope-2.0.1/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/diagnose.md +0 -13
  366. dashscope-2.0.1/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/error-code.md +0 -11
  367. dashscope-2.0.1/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/fine-tuning.md +0 -107
  368. dashscope-2.0.1/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/multimodal.md +0 -109
  369. dashscope-2.0.1/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/retrieval.md +0 -131
  370. dashscope-2.0.1/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/sdk-example.md +0 -13
  371. dashscope-2.0.1/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/speech.md +0 -110
  372. dashscope-2.0.1/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/text-generation.md +0 -145
  373. dashscope-2.0.1/dashscope/acli/examples/dashscope-sdk-expert/.acli/system-prompt.md +0 -107
  374. dashscope-2.0.1/dashscope/acli/examples/dashscope-sdk-expert/README.md +0 -113
  375. dashscope-2.0.1/dashscope/acli/providers/__init__.py +0 -135
  376. dashscope-2.0.1/dashscope/acli/sdk.py +0 -193
  377. dashscope-2.0.1/dashscope/acli/session.py +0 -559
  378. dashscope-2.0.1/dashscope/acli/session_events.py +0 -200
  379. dashscope-2.0.1/dashscope/acli/tools/filesystem.py +0 -399
  380. dashscope-2.0.1/dashscope/acli/tools/platform.py +0 -546
  381. dashscope-2.0.1/dashscope/acli/tools/registry.py +0 -480
  382. dashscope-2.0.1/dashscope/acli/tools/session.py +0 -411
  383. dashscope-2.0.1/dashscope/acli/ui/embedded.py +0 -144
  384. dashscope-2.0.1/dashscope/acli/ui/tui.py +0 -3171
  385. dashscope-2.0.1/dashscope/agentstudio/__init__.py +0 -164
  386. dashscope-2.0.1/dashscope/agentstudio/client.py +0 -243
  387. dashscope-2.0.1/dashscope/agentstudio/resources/__init__.py +0 -95
  388. dashscope-2.0.1/dashscope/agentstudio/resources/_helpers.py +0 -187
  389. dashscope-2.0.1/dashscope/agentstudio/resources/agents.py +0 -346
  390. dashscope-2.0.1/dashscope/agentstudio/resources/deployments.py +0 -463
  391. dashscope-2.0.1/dashscope/agentstudio/resources/environments.py +0 -242
  392. dashscope-2.0.1/dashscope/agentstudio/resources/files.py +0 -389
  393. dashscope-2.0.1/dashscope/agentstudio/resources/memory_stores.py +0 -790
  394. dashscope-2.0.1/dashscope/agentstudio/resources/security.py +0 -136
  395. dashscope-2.0.1/dashscope/agentstudio/resources/session_events.py +0 -377
  396. dashscope-2.0.1/dashscope/agentstudio/resources/session_resources.py +0 -186
  397. dashscope-2.0.1/dashscope/agentstudio/resources/session_threads.py +0 -250
  398. dashscope-2.0.1/dashscope/agentstudio/resources/sessions.py +0 -316
  399. dashscope-2.0.1/dashscope/agentstudio/resources/skills.py +0 -376
  400. dashscope-2.0.1/dashscope/agentstudio/resources/vaults.py +0 -476
  401. dashscope-2.0.1/dashscope/agentstudio/resources/webhook_endpoints.py +0 -280
  402. dashscope-2.0.1/dashscope/agentstudio/streaming.py +0 -226
  403. dashscope-2.0.1/dashscope/agentstudio/transport.py +0 -698
  404. dashscope-2.0.1/dashscope/agentstudio/types/__init__.py +0 -133
  405. dashscope-2.0.1/dashscope/agentstudio/types/models.py +0 -1570
  406. dashscope-2.0.1/dashscope/agentstudio/types/params.py +0 -1069
  407. dashscope-2.0.1/dashscope/aigc/chat_completion.py +0 -301
  408. dashscope-2.0.1/dashscope/aigc/code_generation.py +0 -178
  409. dashscope-2.0.1/dashscope/aigc/conversation.py +0 -410
  410. dashscope-2.0.1/dashscope/aigc/generation.py +0 -568
  411. dashscope-2.0.1/dashscope/aigc/image_generation.py +0 -669
  412. dashscope-2.0.1/dashscope/aigc/image_synthesis.py +0 -1093
  413. dashscope-2.0.1/dashscope/aigc/multimodal_conversation.py +0 -554
  414. dashscope-2.0.1/dashscope/aigc/video_synthesis.py +0 -1046
  415. dashscope-2.0.1/dashscope/api_entities/aio_session.py +0 -129
  416. dashscope-2.0.1/dashscope/api_entities/aiohttp_request.py +0 -331
  417. dashscope-2.0.1/dashscope/api_entities/api_request_data.py +0 -170
  418. dashscope-2.0.1/dashscope/api_entities/api_request_factory.py +0 -237
  419. dashscope-2.0.1/dashscope/api_entities/base_request.py +0 -37
  420. dashscope-2.0.1/dashscope/api_entities/chat_completion_types.py +0 -395
  421. dashscope-2.0.1/dashscope/api_entities/encryption.py +0 -211
  422. dashscope-2.0.1/dashscope/api_entities/http_request.py +0 -659
  423. dashscope-2.0.1/dashscope/api_entities/websocket_request.py +0 -452
  424. dashscope-2.0.1/dashscope/app/application.py +0 -347
  425. dashscope-2.0.1/dashscope/app/application_response.py +0 -272
  426. dashscope-2.0.1/dashscope/assistants/__init__.py +0 -31
  427. dashscope-2.0.1/dashscope/assistants/assistant_types.py +0 -190
  428. dashscope-2.0.1/dashscope/assistants/assistants.py +0 -456
  429. dashscope-2.0.1/dashscope/assistants/files.py +0 -283
  430. dashscope-2.0.1/dashscope/audio/asr/asr_phrase_manager.py +0 -224
  431. dashscope-2.0.1/dashscope/audio/asr/recognition.py +0 -711
  432. dashscope-2.0.1/dashscope/audio/asr/transcription.py +0 -261
  433. dashscope-2.0.1/dashscope/audio/asr/translation_recognizer.py +0 -1184
  434. dashscope-2.0.1/dashscope/audio/asr/vocabulary.py +0 -236
  435. dashscope-2.0.1/dashscope/audio/http_tts/__init__.py +0 -12
  436. dashscope-2.0.1/dashscope/audio/http_tts/http_speech_synthesizer.py +0 -353
  437. dashscope-2.0.1/dashscope/audio/qwen_asr/qwen_transcription.py +0 -216
  438. dashscope-2.0.1/dashscope/audio/qwen_omni/omni_realtime.py +0 -824
  439. dashscope-2.0.1/dashscope/audio/qwen_tts/speech_synthesizer.py +0 -85
  440. dashscope-2.0.1/dashscope/audio/qwen_tts_realtime/qwen_tts_realtime.py +0 -433
  441. dashscope-2.0.1/dashscope/audio/tts/speech_synthesizer.py +0 -229
  442. dashscope-2.0.1/dashscope/audio/tts_v2/enrollment.py +0 -246
  443. dashscope-2.0.1/dashscope/audio/tts_v2/speech_synthesizer.py +0 -1177
  444. dashscope-2.0.1/dashscope/cli/__init__.py +0 -591
  445. dashscope-2.0.1/dashscope/cli/__main__.py +0 -17
  446. dashscope-2.0.1/dashscope/cli/agentic_rl.py +0 -740
  447. dashscope-2.0.1/dashscope/cli/application.py +0 -87
  448. dashscope-2.0.1/dashscope/cli/auth.py +0 -116
  449. dashscope-2.0.1/dashscope/cli/code_generation.py +0 -82
  450. dashscope-2.0.1/dashscope/cli/common.py +0 -188
  451. dashscope-2.0.1/dashscope/cli/deployments.py +0 -279
  452. dashscope-2.0.1/dashscope/cli/embeddings.py +0 -79
  453. dashscope-2.0.1/dashscope/cli/files.py +0 -147
  454. dashscope-2.0.1/dashscope/cli/fine_tunes.py +0 -401
  455. dashscope-2.0.1/dashscope/cli/generation.py +0 -245
  456. dashscope-2.0.1/dashscope/cli/image_generation.py +0 -193
  457. dashscope-2.0.1/dashscope/cli/image_synthesis.py +0 -177
  458. dashscope-2.0.1/dashscope/cli/models.py +0 -54
  459. dashscope-2.0.1/dashscope/cli/multimodal_conversation.py +0 -98
  460. dashscope-2.0.1/dashscope/cli/multimodal_embedding.py +0 -126
  461. dashscope-2.0.1/dashscope/cli/oss.py +0 -83
  462. dashscope-2.0.1/dashscope/cli/rerank.py +0 -71
  463. dashscope-2.0.1/dashscope/cli/speech_synthesis.py +0 -102
  464. dashscope-2.0.1/dashscope/cli/tokenization.py +0 -54
  465. dashscope-2.0.1/dashscope/cli/transcription.py +0 -211
  466. dashscope-2.0.1/dashscope/cli/understanding.py +0 -61
  467. dashscope-2.0.1/dashscope/cli/video_synthesis.py +0 -217
  468. dashscope-2.0.1/dashscope/client/base_api.py +0 -1699
  469. dashscope-2.0.1/dashscope/common/_sdk_session.py +0 -43
  470. dashscope-2.0.1/dashscope/common/api_key.py +0 -55
  471. dashscope-2.0.1/dashscope/common/env.py +0 -145
  472. dashscope-2.0.1/dashscope/common/error.py +0 -146
  473. dashscope-2.0.1/dashscope/common/logging.py +0 -33
  474. dashscope-2.0.1/dashscope/common/message_manager.py +0 -38
  475. dashscope-2.0.1/dashscope/common/utils.py +0 -595
  476. dashscope-2.0.1/dashscope/embeddings/batch_text_embedding.py +0 -235
  477. dashscope-2.0.1/dashscope/embeddings/batch_text_embedding_response.py +0 -74
  478. dashscope-2.0.1/dashscope/embeddings/multimodal_embedding.py +0 -302
  479. dashscope-2.0.1/dashscope/embeddings/text_embedding.py +0 -83
  480. dashscope-2.0.1/dashscope/files.py +0 -136
  481. dashscope-2.0.1/dashscope/finetune/agentic_rl.py +0 -685
  482. dashscope-2.0.1/dashscope/finetune/customize_types.py +0 -193
  483. dashscope-2.0.1/dashscope/finetune/deployments.py +0 -196
  484. dashscope-2.0.1/dashscope/finetune/finetunes.py +0 -291
  485. dashscope-2.0.1/dashscope/finetune/reinforcement/__init__.py +0 -267
  486. dashscope-2.0.1/dashscope/finetune/reinforcement/common/constants.py +0 -144
  487. dashscope-2.0.1/dashscope/finetune/reinforcement/common/log.py +0 -34
  488. dashscope-2.0.1/dashscope/finetune/reinforcement/common/model.py +0 -1838
  489. dashscope-2.0.1/dashscope/finetune/reinforcement/common/utils.py +0 -1072
  490. dashscope-2.0.1/dashscope/finetune/reinforcement/component/__init__.py +0 -116
  491. dashscope-2.0.1/dashscope/finetune/reinforcement/component/data/__init__.py +0 -64
  492. dashscope-2.0.1/dashscope/finetune/reinforcement/component/data/base_data_model.py +0 -232
  493. dashscope-2.0.1/dashscope/finetune/reinforcement/component/data/group_reward_input.py +0 -52
  494. dashscope-2.0.1/dashscope/finetune/reinforcement/component/data/group_reward_output.py +0 -56
  495. dashscope-2.0.1/dashscope/finetune/reinforcement/component/data/reward_input.py +0 -52
  496. dashscope-2.0.1/dashscope/finetune/reinforcement/component/data/reward_output.py +0 -70
  497. dashscope-2.0.1/dashscope/finetune/reinforcement/component/data/rollout_input.py +0 -77
  498. dashscope-2.0.1/dashscope/finetune/reinforcement/component/data/rollout_output.py +0 -55
  499. dashscope-2.0.1/dashscope/finetune/reinforcement/component/demo/__init__.py +0 -19
  500. dashscope-2.0.1/dashscope/finetune/reinforcement/component/demo/group_reward_processor_demo.py +0 -113
  501. dashscope-2.0.1/dashscope/finetune/reinforcement/component/demo/reward_processor_demo.py +0 -97
  502. dashscope-2.0.1/dashscope/finetune/reinforcement/component/demo/rollout_processor_demo.py +0 -96
  503. dashscope-2.0.1/dashscope/finetune/reinforcement/component/func_decorator.py +0 -226
  504. dashscope-2.0.1/dashscope/finetune/reinforcement/component/func_manager.py +0 -338
  505. dashscope-2.0.1/dashscope/finetune/reinforcement/component/observability/__init__.py +0 -122
  506. dashscope-2.0.1/dashscope/finetune/reinforcement/component/observability/genai/__init__.py +0 -146
  507. dashscope-2.0.1/dashscope/finetune/reinforcement/component/observability/genai/_core.py +0 -498
  508. dashscope-2.0.1/dashscope/finetune/reinforcement/component/observability/genai/llm_dashscope.py +0 -190
  509. dashscope-2.0.1/dashscope/finetune/reinforcement/component/observability/genai/llm_openai.py +0 -620
  510. dashscope-2.0.1/dashscope/finetune/reinforcement/component/observability/genai/llm_span.py +0 -237
  511. dashscope-2.0.1/dashscope/finetune/reinforcement/component/observability/genai/messages.py +0 -587
  512. dashscope-2.0.1/dashscope/finetune/reinforcement/component/observability/genai/tools.py +0 -1026
  513. dashscope-2.0.1/dashscope/finetune/reinforcement/component/observability/processor_span.py +0 -323
  514. dashscope-2.0.1/dashscope/finetune/reinforcement/component/observability/tracing.py +0 -822
  515. dashscope-2.0.1/dashscope/finetune/reinforcement/component/parser/__init__.py +0 -20
  516. dashscope-2.0.1/dashscope/finetune/reinforcement/component/parser/base_parser.py +0 -35
  517. dashscope-2.0.1/dashscope/finetune/reinforcement/component/parser/group_reward_parser.py +0 -41
  518. dashscope-2.0.1/dashscope/finetune/reinforcement/component/parser/reward_parser.py +0 -41
  519. dashscope-2.0.1/dashscope/finetune/reinforcement/component/parser/rollout_parser.py +0 -41
  520. dashscope-2.0.1/dashscope/finetune/reinforcement/component/processor/__init__.py +0 -20
  521. dashscope-2.0.1/dashscope/finetune/reinforcement/component/processor/abstract_group_reward_processor.py +0 -83
  522. dashscope-2.0.1/dashscope/finetune/reinforcement/component/processor/abstract_processor.py +0 -54
  523. dashscope-2.0.1/dashscope/finetune/reinforcement/component/processor/abstract_reward_processor.py +0 -201
  524. dashscope-2.0.1/dashscope/finetune/reinforcement/component/processor/abstract_rollout_processor.py +0 -78
  525. dashscope-2.0.1/dashscope/finetune/reinforcement/component/server/server.py +0 -631
  526. dashscope-2.0.1/dashscope/io/input_output.py +0 -132
  527. dashscope-2.0.1/dashscope/model.py +0 -62
  528. dashscope-2.0.1/dashscope/models.py +0 -78
  529. dashscope-2.0.1/dashscope/multimodal/multimodal_dialog.py +0 -801
  530. dashscope-2.0.1/dashscope/multimodal/tingwu/tingwu.py +0 -85
  531. dashscope-2.0.1/dashscope/multimodal/tingwu/tingwu_realtime.py +0 -638
  532. dashscope-2.0.1/dashscope/nlp/understanding.py +0 -90
  533. dashscope-2.0.1/dashscope/rerank/__init__.py +0 -6
  534. dashscope-2.0.1/dashscope/rerank/text_rerank.py +0 -178
  535. dashscope-2.0.1/dashscope/threads/__init__.py +0 -29
  536. dashscope-2.0.1/dashscope/threads/messages/files.py +0 -127
  537. dashscope-2.0.1/dashscope/threads/messages/messages.py +0 -292
  538. dashscope-2.0.1/dashscope/threads/runs/runs.py +0 -649
  539. dashscope-2.0.1/dashscope/threads/runs/steps.py +0 -154
  540. dashscope-2.0.1/dashscope/threads/thread_types.py +0 -708
  541. dashscope-2.0.1/dashscope/threads/threads.py +0 -299
  542. dashscope-2.0.1/dashscope/tokenizers/tokenization.py +0 -174
  543. dashscope-2.0.1/dashscope/tokenizers/tokenizer.py +0 -49
  544. dashscope-2.0.1/dashscope/utils/oss_utils.py +0 -312
  545. dashscope-2.0.1/dashscope/v2/__init__.py +0 -40
  546. dashscope-2.0.1/dashscope/v2/_config.py +0 -734
  547. dashscope-2.0.1/dashscope/v2/_error_registry.py +0 -650
  548. dashscope-2.0.1/dashscope/v2/_logging.py +0 -138
  549. dashscope-2.0.1/dashscope/v2/_quickstart.py +0 -38
  550. dashscope-2.0.1/dashscope/v2/client.py +0 -492
  551. dashscope-2.0.1/dashscope/v2/errors.py +0 -462
  552. dashscope-2.0.1/dashscope/v2/protocols/__init__.py +0 -49
  553. dashscope-2.0.1/dashscope/v2/protocols/anthropic.py +0 -702
  554. dashscope-2.0.1/dashscope/v2/protocols/base.py +0 -127
  555. dashscope-2.0.1/dashscope/v2/protocols/native.py +0 -176
  556. dashscope-2.0.1/dashscope/v2/protocols/openai.py +0 -265
  557. dashscope-2.0.1/dashscope/v2/resources/_agentstudio.py +0 -384
  558. dashscope-2.0.1/dashscope/v2/resources/_jobs.py +0 -625
  559. dashscope-2.0.1/dashscope/v2/resources/_oss.py +0 -230
  560. dashscope-2.0.1/dashscope/v2/resources/_sse.py +0 -78
  561. dashscope-2.0.1/dashscope/v2/resources/apps.py +0 -572
  562. dashscope-2.0.1/dashscope/v2/resources/audio/__init__.py +0 -101
  563. dashscope-2.0.1/dashscope/v2/resources/audio/_callbacks.py +0 -70
  564. dashscope-2.0.1/dashscope/v2/resources/audio/asr.py +0 -684
  565. dashscope-2.0.1/dashscope/v2/resources/audio/customization.py +0 -586
  566. dashscope-2.0.1/dashscope/v2/resources/audio/http_tts.py +0 -447
  567. dashscope-2.0.1/dashscope/v2/resources/audio/phrases.py +0 -254
  568. dashscope-2.0.1/dashscope/v2/resources/audio/realtime.py +0 -855
  569. dashscope-2.0.1/dashscope/v2/resources/audio/tts.py +0 -425
  570. dashscope-2.0.1/dashscope/v2/resources/chat/__init__.py +0 -39
  571. dashscope-2.0.1/dashscope/v2/resources/chat/completions.py +0 -996
  572. dashscope-2.0.1/dashscope/v2/resources/decision.py +0 -287
  573. dashscope-2.0.1/dashscope/v2/resources/deployments.py +0 -455
  574. dashscope-2.0.1/dashscope/v2/resources/embeddings.py +0 -429
  575. dashscope-2.0.1/dashscope/v2/resources/files.py +0 -386
  576. dashscope-2.0.1/dashscope/v2/resources/fine_tunes.py +0 -691
  577. dashscope-2.0.1/dashscope/v2/resources/images.py +0 -812
  578. dashscope-2.0.1/dashscope/v2/resources/models.py +0 -228
  579. dashscope-2.0.1/dashscope/v2/resources/multimodal/__init__.py +0 -31
  580. dashscope-2.0.1/dashscope/v2/resources/multimodal/chat.py +0 -333
  581. dashscope-2.0.1/dashscope/v2/resources/multimodal/embeddings.py +0 -244
  582. dashscope-2.0.1/dashscope/v2/resources/reinforcement_learning.py +0 -897
  583. dashscope-2.0.1/dashscope/v2/resources/rerank.py +0 -168
  584. dashscope-2.0.1/dashscope/v2/resources/tingwu.py +0 -340
  585. dashscope-2.0.1/dashscope/v2/resources/tokenization.py +0 -142
  586. dashscope-2.0.1/dashscope/v2/resources/videos.py +0 -591
  587. dashscope-2.0.1/dashscope/v2/transport/__init__.py +0 -11
  588. dashscope-2.0.1/dashscope/v2/transport/_ident.py +0 -91
  589. dashscope-2.0.1/dashscope/v2/transport/http.py +0 -466
  590. dashscope-2.0.1/dashscope/v2/transport/sse.py +0 -156
  591. dashscope-2.0.1/dashscope/v2/transport/ws.py +0 -357
  592. dashscope-2.0.1/dashscope/v2/transport/ws_connection.py +0 -468
  593. dashscope-2.0.1/dashscope/v2/types/__init__.py +0 -49
  594. dashscope-2.0.1/dashscope/v2/types/common.py +0 -198
  595. dashscope-2.0.1/dashscope/v2/types/completions.py +0 -170
  596. dashscope-2.0.1/dashscope/v2/types/messages.py +0 -241
  597. dashscope-2.0.1/dashscope/version.py +0 -4
  598. dashscope-2.0.1/dashscope.egg-info/PKG-INFO +0 -532
  599. dashscope-2.0.1/dashscope.egg-info/SOURCES.txt +0 -515
  600. dashscope-2.0.1/dashscope.egg-info/entry_points.txt +0 -2
  601. dashscope-2.0.1/dashscope.egg-info/requires.txt +0 -51
  602. dashscope-2.0.1/examples/01_atomic_capabilities/audio/asr_file.py +0 -215
  603. dashscope-2.0.1/examples/01_atomic_capabilities/audio/asr_http_stream.py +0 -142
  604. dashscope-2.0.1/examples/01_atomic_capabilities/audio/direct_call/asr_file.py +0 -232
  605. dashscope-2.0.1/examples/01_atomic_capabilities/audio/direct_call/asr_http_stream.py +0 -153
  606. dashscope-2.0.1/examples/01_atomic_capabilities/audio/direct_call/realtime_omni.py +0 -225
  607. dashscope-2.0.1/examples/01_atomic_capabilities/audio/direct_call/realtime_qwen_audio.py +0 -222
  608. dashscope-2.0.1/examples/01_atomic_capabilities/audio/direct_call/realtime_translation.py +0 -226
  609. dashscope-2.0.1/examples/01_atomic_capabilities/audio/direct_call/tts_websocket.py +0 -197
  610. dashscope-2.0.1/examples/01_atomic_capabilities/audio/direct_call/voice_clone.py +0 -283
  611. dashscope-2.0.1/examples/01_atomic_capabilities/audio/realtime_omni.py +0 -198
  612. dashscope-2.0.1/examples/01_atomic_capabilities/audio/realtime_qwen_audio.py +0 -196
  613. dashscope-2.0.1/examples/01_atomic_capabilities/audio/realtime_translation.py +0 -200
  614. dashscope-2.0.1/examples/01_atomic_capabilities/audio/tts_websocket.py +0 -180
  615. dashscope-2.0.1/examples/01_atomic_capabilities/audio/voice_clone.py +0 -277
  616. dashscope-2.0.1/examples/01_atomic_capabilities/decision/decision.py +0 -107
  617. dashscope-2.0.1/examples/02_advanced_engineering/circuit_breaker_retry.py +0 -217
  618. dashscope-2.0.1/examples/02_advanced_engineering/local_mock_debugging.py +0 -116
  619. dashscope-2.0.1/examples/03_agent_recipes/agentstudio.py +0 -138
  620. dashscope-2.0.1/examples/04_real_world_scenarios/README.md +0 -192
  621. dashscope-2.0.1/examples/04_real_world_scenarios/README_zh.md +0 -192
  622. dashscope-2.0.1/examples/04_real_world_scenarios/production_ready_rag_harness.py +0 -717
  623. dashscope-2.0.1/examples/04_real_world_scenarios/realtime_audio_meeting_harness.py +0 -541
  624. dashscope-2.0.1/examples/04_real_world_scenarios/ticket_triage_harness.py +0 -493
  625. dashscope-2.0.1/examples/README.md +0 -159
  626. dashscope-2.0.1/examples/README_zh.md +0 -159
  627. dashscope-2.0.1/examples/legacy_1x/aio_generation/basic.py +0 -48
  628. dashscope-2.0.1/examples/legacy_1x/aio_generation/custom_session.py +0 -96
  629. dashscope-2.0.1/examples/legacy_1x/aio_generation/deep_research.py +0 -165
  630. dashscope-2.0.1/examples/legacy_1x/aio_generation/reasoning.py +0 -46
  631. dashscope-2.0.1/examples/legacy_1x/aio_generation/tool_calls.py +0 -74
  632. dashscope-2.0.1/examples/legacy_1x/aio_image_synthesis.py +0 -84
  633. dashscope-2.0.1/examples/legacy_1x/aio_video_synthesis.py +0 -74
  634. dashscope-2.0.1/examples/legacy_1x/assistant_api_file.py +0 -31
  635. dashscope-2.0.1/examples/legacy_1x/cv_models.py +0 -50
  636. dashscope-2.0.1/examples/legacy_1x/image_generation.py +0 -103
  637. dashscope-2.0.1/examples/legacy_1x/set_region_example.py +0 -126
  638. dashscope-2.0.1/examples/legacy_1x/tingwu_realtime.py +0 -150
  639. dashscope-2.0.1/examples/legacy_1x/tingwu_usages.py +0 -28
  640. dashscope-2.0.1/requirements.txt +0 -17
  641. dashscope-2.0.1/setup.py +0 -130
  642. {dashscope-2.0.1 → dashscope-2.0.3}/LICENSE +0 -0
  643. {dashscope-2.0.1 → dashscope-2.0.3}/LICENSE.certifi +0 -0
  644. {dashscope-2.0.1 → dashscope-2.0.3}/NOTICE +0 -0
  645. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/__init__.py +0 -0
  646. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/__main__.py +0 -0
  647. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/acceptance.py +0 -0
  648. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/agents/__init__.py +0 -0
  649. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/agents/delegate.py +0 -0
  650. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/agents/subagent.py +0 -0
  651. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/agents/subagents.py +0 -0
  652. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/audit.py +0 -0
  653. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/capabilities/__init__.py +0 -0
  654. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/capabilities/local_memory.py +0 -0
  655. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/cli/__init__.py +0 -0
  656. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/cli/completer.py +0 -0
  657. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/cli/constants.py +0 -0
  658. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/cli/examples.py +0 -0
  659. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/cli/handlers_capability.py +0 -0
  660. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/cli/handlers_config.py +0 -0
  661. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/cli/handlers_device.py +0 -0
  662. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/cli/handlers_key.py +0 -0
  663. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/cli/handlers_misc.py +0 -0
  664. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/cli/handlers_profile.py +0 -0
  665. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/cli/handlers_provider.py +0 -0
  666. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/cli/handlers_session.py +0 -0
  667. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/cli/handlers_setup.py +0 -0
  668. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/cli/handlers_skill.py +0 -0
  669. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/cli/mcp.py +0 -0
  670. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/cli/multimodal.py +0 -0
  671. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/cli/repl.py +0 -0
  672. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/cli/runners.py +0 -0
  673. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/cli/startup.py +0 -0
  674. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/cli/streaming.py +0 -0
  675. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/commands.py +0 -0
  676. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/compression.py +0 -0
  677. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/debuglog.py +0 -0
  678. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/deliverable.py +0 -0
  679. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/dev.py +0 -0
  680. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/eval/__init__.py +0 -0
  681. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/examples/basic-chat/.acli/config.toml +0 -0
  682. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/examples/basic-chat/.acli/custom-extensions.toml +0 -0
  683. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/examples/basic-chat/.acli/hooks.toml +0 -0
  684. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/examples/basic-chat/.acli/skills/explain-code.md +0 -0
  685. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/examples/basic-chat/.acli/skills/research-topic.md +0 -0
  686. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/examples/basic-chat/.acli/skills/translate.md +0 -0
  687. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/examples/basic-chat/.acli/skills/write-poem.md +0 -0
  688. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/examples/basic-chat/.acli/system-prompt.md +0 -0
  689. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/examples/basic-chat/README.md +0 -0
  690. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/examples/dashscope-sdk-expert/.acli/config.toml +0 -0
  691. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/examples/dashscope-sdk-expert/.acli/custom-extensions.toml +0 -0
  692. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/examples/dashscope-sdk-expert/.acli/hooks.toml +0 -0
  693. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/explain-code.md +0 -0
  694. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/translate.md +0 -0
  695. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/executor.py +0 -0
  696. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/extensions.py +0 -0
  697. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/hooks.py +0 -0
  698. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/mcp_server.py +0 -0
  699. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/mcp_stdio.py +0 -0
  700. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/memory/__init__.py +0 -0
  701. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/memory/directives_learning.py +0 -0
  702. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/memory/experience.py +0 -0
  703. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/memory/manager.py +0 -0
  704. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/memory/plan.py +0 -0
  705. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/memory/reflection.py +0 -0
  706. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/memory/skill_evolution.py +0 -0
  707. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/memory/tool_chains.py +0 -0
  708. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/memory/trace.py +0 -0
  709. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/permission.py +0 -0
  710. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/platforms/__init__.py +0 -0
  711. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/platforms/bailian/__init__.py +0 -0
  712. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/platforms/bailian/cli.py +0 -0
  713. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/platforms/bailian/mcp.py +0 -0
  714. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/platforms/base.py +0 -0
  715. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/platforms/local/__init__.py +0 -0
  716. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/platforms/local/history.py +0 -0
  717. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/platforms/local/memory.py +0 -0
  718. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/prompt.py +0 -0
  719. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/prompt_pipeline.py +0 -0
  720. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/providers/adapter.py +0 -0
  721. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/providers/anthropic.py +0 -0
  722. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/providers/base.py +0 -0
  723. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/providers/hardening.py +0 -0
  724. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/providers/openai.py +0 -0
  725. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/providers/profile.py +0 -0
  726. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/providers/tongyi.py +0 -0
  727. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/sandbox.py +0 -0
  728. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/scheduler.py +0 -0
  729. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/skills/__init__.py +0 -0
  730. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/skills/base.py +0 -0
  731. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/skills/manager.py +0 -0
  732. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/skills/package.py +0 -0
  733. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/skills/store.py +0 -0
  734. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/tools/__init__.py +0 -0
  735. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/tools/browser.py +0 -0
  736. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/tools/camera.py +0 -0
  737. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/tools/checkpoint.py +0 -0
  738. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/tools/evolution.py +0 -0
  739. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/tools/shell.py +0 -0
  740. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/tools/skills.py +0 -0
  741. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/tools/vision.py +0 -0
  742. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/tools/web_search.py +0 -0
  743. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/ui/__init__.py +0 -0
  744. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/ui/camera.py +0 -0
  745. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/ui/tts.py +0 -0
  746. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/ui/voice.py +0 -0
  747. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/utils/__init__.py +0 -0
  748. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/utils/clipboard.py +0 -0
  749. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/utils/crypto.py +0 -0
  750. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/utils/exceptions.py +0 -0
  751. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/utils/ids.py +0 -0
  752. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/utils/images.py +0 -0
  753. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/utils/keywords.py +0 -0
  754. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/utils/messages.py +0 -0
  755. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/utils/paths.py +0 -0
  756. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/utils/sanitizer.py +0 -0
  757. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/utils/spinner.py +0 -0
  758. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/utils/template.py +0 -0
  759. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/utils/text.py +0 -0
  760. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/utils/toml.py +0 -0
  761. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope/acli/utils/validation.py +0 -0
  762. {dashscope-2.0.1/dashscope → dashscope-2.0.3/dashscope/applications}/agentstudio/constants.py +0 -0
  763. {dashscope-2.0.1/dashscope → dashscope-2.0.3/dashscope/applications}/agentstudio/pagination.py +0 -0
  764. {dashscope-2.0.1/dashscope/api_entities → dashscope-2.0.3/dashscope/applications/finetune}/__init__.py +0 -0
  765. {dashscope-2.0.1/dashscope/client → dashscope-2.0.3/dashscope/applications/finetune/reinforcement/common}/__init__.py +0 -0
  766. /dashscope-2.0.1/dashscope/finetune/reinforcement/common/errors.py → /dashscope-2.0.3/dashscope/applications/finetune/reinforcement/common/_legacy_errors.py +0 -0
  767. {dashscope-2.0.1/dashscope → dashscope-2.0.3/dashscope/applications}/finetune/reinforcement/common/model_types.py +0 -0
  768. {dashscope-2.0.1/dashscope/common → dashscope-2.0.3/dashscope/applications/finetune/reinforcement/component/server}/__init__.py +0 -0
  769. {dashscope-2.0.1/dashscope → dashscope-2.0.3/dashscope/legacy_1x}/agentstudio/exceptions.py +0 -0
  770. {dashscope-2.0.1/dashscope → dashscope-2.0.3/dashscope/legacy_1x}/aigc/__init__.py +0 -0
  771. {dashscope-2.0.1/dashscope/finetune → dashscope-2.0.3/dashscope/legacy_1x/api_entities}/__init__.py +0 -0
  772. {dashscope-2.0.1/dashscope → dashscope-2.0.3/dashscope/legacy_1x}/api_entities/dashscope_response.py +0 -0
  773. {dashscope-2.0.1/dashscope → dashscope-2.0.3/dashscope/legacy_1x}/app/__init__.py +0 -0
  774. {dashscope-2.0.1/dashscope → dashscope-2.0.3/dashscope/legacy_1x}/audio/__init__.py +0 -0
  775. {dashscope-2.0.1/dashscope → dashscope-2.0.3/dashscope/legacy_1x}/audio/asr/__init__.py +0 -0
  776. {dashscope-2.0.1/dashscope → dashscope-2.0.3/dashscope/legacy_1x}/audio/qwen_asr/__init__.py +0 -0
  777. {dashscope-2.0.1/dashscope → dashscope-2.0.3/dashscope/legacy_1x}/audio/qwen_omni/__init__.py +0 -0
  778. {dashscope-2.0.1/dashscope → dashscope-2.0.3/dashscope/legacy_1x}/audio/qwen_tts/__init__.py +0 -0
  779. {dashscope-2.0.1/dashscope → dashscope-2.0.3/dashscope/legacy_1x}/audio/qwen_tts_realtime/__init__.py +0 -0
  780. {dashscope-2.0.1/dashscope → dashscope-2.0.3/dashscope/legacy_1x}/audio/tts/__init__.py +0 -0
  781. {dashscope-2.0.1/dashscope → dashscope-2.0.3/dashscope/legacy_1x}/audio/tts_v2/__init__.py +0 -0
  782. {dashscope-2.0.1/dashscope/finetune/reinforcement/common → dashscope-2.0.3/dashscope/legacy_1x/client}/__init__.py +0 -0
  783. {dashscope-2.0.1/dashscope/finetune/reinforcement/component/server → dashscope-2.0.3/dashscope/legacy_1x/common}/__init__.py +0 -0
  784. {dashscope-2.0.1/dashscope → dashscope-2.0.3/dashscope/legacy_1x}/common/base_type.py +0 -0
  785. {dashscope-2.0.1/dashscope → dashscope-2.0.3/dashscope/legacy_1x}/common/constants.py +0 -0
  786. {dashscope-2.0.1/dashscope → dashscope-2.0.3/dashscope/legacy_1x}/embeddings/__init__.py +0 -0
  787. {dashscope-2.0.1/dashscope/io → dashscope-2.0.3/dashscope/legacy_1x/finetune}/__init__.py +0 -0
  788. {dashscope-2.0.1/dashscope/nlp → dashscope-2.0.3/dashscope/legacy_1x/io}/__init__.py +0 -0
  789. {dashscope-2.0.1/dashscope → dashscope-2.0.3/dashscope/legacy_1x}/multimodal/__init__.py +0 -0
  790. {dashscope-2.0.1/dashscope → dashscope-2.0.3/dashscope/legacy_1x}/multimodal/dialog_state.py +0 -0
  791. {dashscope-2.0.1/dashscope → dashscope-2.0.3/dashscope/legacy_1x}/multimodal/multimodal_constants.py +0 -0
  792. {dashscope-2.0.1/dashscope → dashscope-2.0.3/dashscope/legacy_1x}/multimodal/multimodal_request_params.py +0 -0
  793. {dashscope-2.0.1/dashscope → dashscope-2.0.3/dashscope/legacy_1x}/multimodal/tingwu/__init__.py +0 -0
  794. {dashscope-2.0.1/dashscope/protocol → dashscope-2.0.3/dashscope/legacy_1x/nlp}/__init__.py +0 -0
  795. {dashscope-2.0.1/dashscope/threads/messages → dashscope-2.0.3/dashscope/legacy_1x/protocol}/__init__.py +0 -0
  796. {dashscope-2.0.1/dashscope → dashscope-2.0.3/dashscope/legacy_1x}/protocol/websocket.py +0 -0
  797. {dashscope-2.0.1/dashscope/threads/runs → dashscope-2.0.3/dashscope/legacy_1x/threads/messages}/__init__.py +0 -0
  798. {dashscope-2.0.1/dashscope/utils → dashscope-2.0.3/dashscope/legacy_1x/threads/runs}/__init__.py +0 -0
  799. {dashscope-2.0.1/dashscope → dashscope-2.0.3/dashscope/legacy_1x}/tokenizers/__init__.py +0 -0
  800. {dashscope-2.0.1/dashscope/resources → dashscope-2.0.3/dashscope/legacy_1x/tokenizers}/qwen.tiktoken +0 -0
  801. {dashscope-2.0.1/dashscope → dashscope-2.0.3/dashscope/legacy_1x}/tokenizers/qwen_tokenizer.py +0 -0
  802. {dashscope-2.0.1/dashscope → dashscope-2.0.3/dashscope/legacy_1x}/tokenizers/tokenizer_base.py +0 -0
  803. /dashscope-2.0.1/dashscope/py.typed → /dashscope-2.0.3/dashscope/legacy_1x/utils/__init__.py +0 -0
  804. {dashscope-2.0.1/dashscope → dashscope-2.0.3/dashscope/legacy_1x}/utils/message_utils.py +0 -0
  805. {dashscope-2.0.1/dashscope → dashscope-2.0.3/dashscope/legacy_1x}/utils/param_utils.py +0 -0
  806. {dashscope-2.0.1/dashscope/v2 → dashscope-2.0.3/dashscope}/resources/__init__.py +0 -0
  807. {dashscope-2.0.1/dashscope/v2 → dashscope-2.0.3/dashscope}/transport/_retry.py +0 -0
  808. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope.egg-info/dependency_links.txt +0 -0
  809. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope.egg-info/not-zip-safe +0 -0
  810. {dashscope-2.0.1 → dashscope-2.0.3}/dashscope.egg-info/top_level.txt +0 -0
  811. {dashscope-2.0.1 → dashscope-2.0.3}/examples/01_atomic_capabilities/applications/apps.py +0 -0
  812. {dashscope-2.0.1 → dashscope-2.0.3}/examples/01_atomic_capabilities/audio/README.md +0 -0
  813. {dashscope-2.0.1 → dashscope-2.0.3}/examples/01_atomic_capabilities/audio/_common.py +0 -0
  814. {dashscope-2.0.1 → dashscope-2.0.3}/examples/01_atomic_capabilities/audio/asr_microphone.py +0 -0
  815. {dashscope-2.0.1 → dashscope-2.0.3}/examples/01_atomic_capabilities/audio/asr_websocket.py +0 -0
  816. {dashscope-2.0.1 → dashscope-2.0.3}/examples/01_atomic_capabilities/audio/connection_reuse.py +0 -0
  817. {dashscope-2.0.1 → dashscope-2.0.3}/examples/01_atomic_capabilities/audio/direct_call/_common.py +0 -0
  818. {dashscope-2.0.1 → dashscope-2.0.3}/examples/01_atomic_capabilities/audio/direct_call/asr_microphone.py +0 -0
  819. {dashscope-2.0.1 → dashscope-2.0.3}/examples/01_atomic_capabilities/audio/direct_call/asr_websocket.py +0 -0
  820. {dashscope-2.0.1 → dashscope-2.0.3}/examples/01_atomic_capabilities/audio/direct_call/connection_reuse.py +0 -0
  821. {dashscope-2.0.1 → dashscope-2.0.3}/examples/01_atomic_capabilities/audio/direct_call/tts_http.py +0 -0
  822. {dashscope-2.0.1 → dashscope-2.0.3}/examples/01_atomic_capabilities/audio/direct_call/tts_http_stream.py +0 -0
  823. {dashscope-2.0.1 → dashscope-2.0.3}/examples/01_atomic_capabilities/audio/tingwu.py +0 -0
  824. {dashscope-2.0.1 → dashscope-2.0.3}/examples/01_atomic_capabilities/audio/tts_http.py +0 -0
  825. {dashscope-2.0.1 → dashscope-2.0.3}/examples/01_atomic_capabilities/audio/tts_http_stream.py +0 -0
  826. {dashscope-2.0.1 → dashscope-2.0.3}/examples/01_atomic_capabilities/embeddings/embeddings.py +0 -0
  827. {dashscope-2.0.1 → dashscope-2.0.3}/examples/01_atomic_capabilities/files/files.py +0 -0
  828. {dashscope-2.0.1 → dashscope-2.0.3}/examples/01_atomic_capabilities/fine_tuning/fine_tunes.py +0 -0
  829. {dashscope-2.0.1 → dashscope-2.0.3}/examples/01_atomic_capabilities/fine_tuning/reinforcement_learning.py +0 -0
  830. {dashscope-2.0.1 → dashscope-2.0.3}/examples/01_atomic_capabilities/image_video_synthesis/images.py +0 -0
  831. {dashscope-2.0.1 → dashscope-2.0.3}/examples/01_atomic_capabilities/image_video_synthesis/videos.py +0 -0
  832. {dashscope-2.0.1 → dashscope-2.0.3}/examples/01_atomic_capabilities/models/models.py +0 -0
  833. {dashscope-2.0.1 → dashscope-2.0.3}/examples/01_atomic_capabilities/multimodal_vision/multimodal_chat.py +0 -0
  834. {dashscope-2.0.1 → dashscope-2.0.3}/examples/01_atomic_capabilities/rerank/rerank.py +0 -0
  835. {dashscope-2.0.1 → dashscope-2.0.3}/examples/01_atomic_capabilities/text_generation/chat.py +0 -0
  836. {dashscope-2.0.1 → dashscope-2.0.3}/examples/01_atomic_capabilities/text_generation/tokenization.py +0 -0
  837. {dashscope-2.0.1 → dashscope-2.0.3}/examples/02_advanced_engineering/client_side_cache.py +0 -0
  838. {dashscope-2.0.1 → dashscope-2.0.3}/examples/03_agent_recipes/agentstudio_deployments.py +0 -0
  839. {dashscope-2.0.1 → dashscope-2.0.3}/examples/03_agent_recipes/mcp_server_demo/README.md +0 -0
  840. {dashscope-2.0.1 → dashscope-2.0.3}/examples/03_agent_recipes/mcp_server_demo/client_demo.py +0 -0
  841. {dashscope-2.0.1 → dashscope-2.0.3}/examples/03_agent_recipes/mcp_server_demo/server.py +0 -0
  842. {dashscope-2.0.1 → dashscope-2.0.3}/examples/03_agent_recipes/rag_expert_system.py +0 -0
  843. {dashscope-2.0.1 → dashscope-2.0.3}/examples/03_agent_recipes/tool_call_loop.py +0 -0
  844. {dashscope-2.0.1 → dashscope-2.0.3}/examples/04_real_world_scenarios/customer_service_assistant.py +0 -0
  845. {dashscope-2.0.1 → dashscope-2.0.3}/examples/legacy_1x/aio_multimodal_conversation/asr.py +0 -0
  846. {dashscope-2.0.1 → dashscope-2.0.3}/examples/legacy_1x/aio_multimodal_conversation/image.py +0 -0
  847. {dashscope-2.0.1 → dashscope-2.0.3}/examples/legacy_1x/aio_multimodal_conversation/ocr.py +0 -0
  848. {dashscope-2.0.1 → dashscope-2.0.3}/examples/legacy_1x/aio_multimodal_conversation/tool_calls.py +0 -0
  849. {dashscope-2.0.1 → dashscope-2.0.3}/examples/legacy_1x/application.py +0 -0
  850. {dashscope-2.0.1 → dashscope-2.0.3}/examples/legacy_1x/assistant_api.py +0 -0
  851. {dashscope-2.0.1 → dashscope-2.0.3}/examples/legacy_1x/assistant_api_simple.py +0 -0
  852. {dashscope-2.0.1 → dashscope-2.0.3}/examples/legacy_1x/generation/basic.py +0 -0
  853. {dashscope-2.0.1 → dashscope-2.0.3}/examples/legacy_1x/generation/custom_session.py +0 -0
  854. {dashscope-2.0.1 → dashscope-2.0.3}/examples/legacy_1x/generation/deep_research.py +0 -0
  855. {dashscope-2.0.1 → dashscope-2.0.3}/examples/legacy_1x/generation/reasoning.py +0 -0
  856. {dashscope-2.0.1 → dashscope-2.0.3}/examples/legacy_1x/generation/tool_calls.py +0 -0
  857. {dashscope-2.0.1 → dashscope-2.0.3}/examples/legacy_1x/image_synthesis.py +0 -0
  858. {dashscope-2.0.1 → dashscope-2.0.3}/examples/legacy_1x/multimodal_conversation/asr.py +0 -0
  859. {dashscope-2.0.1 → dashscope-2.0.3}/examples/legacy_1x/multimodal_conversation/image.py +0 -0
  860. {dashscope-2.0.1 → dashscope-2.0.3}/examples/legacy_1x/multimodal_conversation/ocr.py +0 -0
  861. {dashscope-2.0.1 → dashscope-2.0.3}/examples/legacy_1x/multimodal_conversation/reasoning.py +0 -0
  862. {dashscope-2.0.1 → dashscope-2.0.3}/examples/legacy_1x/multimodal_conversation/tool_calls.py +0 -0
  863. {dashscope-2.0.1 → dashscope-2.0.3}/examples/legacy_1x/multimodal_conversation/video.py +0 -0
  864. {dashscope-2.0.1 → dashscope-2.0.3}/examples/legacy_1x/multimodal_embedding.py +0 -0
  865. {dashscope-2.0.1 → dashscope-2.0.3}/examples/legacy_1x/qwen_asr.py +0 -0
  866. {dashscope-2.0.1 → dashscope-2.0.3}/examples/legacy_1x/qwen_tts.py +0 -0
  867. {dashscope-2.0.1 → dashscope-2.0.3}/examples/legacy_1x/text_rerank.py +0 -0
  868. {dashscope-2.0.1 → dashscope-2.0.3}/examples/legacy_1x/video_synthesis.py +0 -0
  869. {dashscope-2.0.1 → dashscope-2.0.3}/setup.cfg +0 -0
@@ -0,0 +1,8 @@
1
+ include dashscope/legacy_1x/tokenizers/qwen.tiktoken
2
+ include dashscope/py.typed
3
+ include dashscope/__init__.pyi
4
+ include NOTICE
5
+ include LICENSE.certifi
6
+ recursive-include dashscope/acli/examples *.md *.toml *.py
7
+ recursive-include examples *.md *.py
8
+ include requirements.txt
@@ -0,0 +1,609 @@
1
+ Metadata-Version: 2.4
2
+ Name: dashscope
3
+ Version: 2.0.3
4
+ Summary: dashscope client sdk library
5
+ Home-page: https://dashscope.aliyun.com/
6
+ Author: Alibaba Cloud
7
+ Author-email: dashscope@alibabacloud.com
8
+ License: Apache 2.0
9
+ Platform: Posix; MacOS X; Windows
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Programming Language :: Python
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Requires-Python: >=3.9
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ License-File: LICENSE.certifi
25
+ License-File: NOTICE
26
+ Requires-Dist: aiohttp
27
+ Requires-Dist: requests
28
+ Requires-Dist: websocket-client
29
+ Requires-Dist: cryptography
30
+ Requires-Dist: certifi>=2024.7.4
31
+ Requires-Dist: typer>=0.9.0
32
+ Requires-Dist: rich>=13.0.0
33
+ Requires-Dist: tomli>=1.1.0; python_version < "3.11"
34
+ Requires-Dist: httpx>=0.27.0
35
+ Requires-Dist: httpx-sse>=0.4.0
36
+ Requires-Dist: typing_extensions>=4.16.0
37
+ Requires-Dist: tiktoken
38
+ Requires-Dist: pydantic>=2.0
39
+ Requires-Dist: tenacity
40
+ Requires-Dist: PyYAML>=6.0
41
+ Requires-Dist: fastapi>=0.100
42
+ Requires-Dist: uvicorn>=0.20
43
+ Requires-Dist: opentelemetry-sdk>=1.20
44
+ Provides-Extra: acli
45
+ Requires-Dist: prompt-toolkit>=3.0; extra == "acli"
46
+ Requires-Dist: textual<9,>=0.50; extra == "acli"
47
+ Requires-Dist: PyYAML>=6.0; extra == "acli"
48
+ Requires-Dist: tomli>=2.0; python_version < "3.11" and extra == "acli"
49
+ Provides-Extra: acli-anthropic
50
+ Requires-Dist: anthropic<2,>=0.40; extra == "acli-anthropic"
51
+ Provides-Extra: acli-openai
52
+ Requires-Dist: openai<4,>=1.30; extra == "acli-openai"
53
+ Provides-Extra: acli-voice
54
+ Requires-Dist: sounddevice>=0.4; extra == "acli-voice"
55
+ Requires-Dist: numpy>=1.20; extra == "acli-voice"
56
+ Provides-Extra: acli-camera
57
+ Requires-Dist: opencv-python-headless>=4.5; extra == "acli-camera"
58
+ Provides-Extra: acli-all
59
+ Requires-Dist: prompt-toolkit>=3.0; extra == "acli-all"
60
+ Requires-Dist: textual<9,>=0.50; extra == "acli-all"
61
+ Requires-Dist: PyYAML>=6.0; extra == "acli-all"
62
+ Requires-Dist: tomli>=2.0; python_version < "3.11" and extra == "acli-all"
63
+ Requires-Dist: anthropic<2,>=0.40; extra == "acli-all"
64
+ Requires-Dist: openai<4,>=1.30; extra == "acli-all"
65
+ Requires-Dist: sounddevice>=0.4; extra == "acli-all"
66
+ Requires-Dist: numpy>=1.20; extra == "acli-all"
67
+ Requires-Dist: opencv-python-headless>=4.5; extra == "acli-all"
68
+ Dynamic: author
69
+ Dynamic: author-email
70
+ Dynamic: classifier
71
+ Dynamic: description
72
+ Dynamic: description-content-type
73
+ Dynamic: home-page
74
+ Dynamic: license
75
+ Dynamic: license-file
76
+ Dynamic: platform
77
+ Dynamic: provides-extra
78
+ Dynamic: requires-dist
79
+ Dynamic: requires-python
80
+ Dynamic: summary
81
+
82
+ # DashScope Python SDK
83
+
84
+ > **English** | [中文](README_zh.md)
85
+
86
+ The DashScope Python SDK is the official client for [Alibaba Cloud Model Studio (Bailian)](https://www.alibabacloud.com/help/en/model-studio/), covering text generation, multi-modal understanding, embeddings, reranking, image/video generation, speech synthesis & recognition, fine-tuning, agentic RL, applications and more.
87
+
88
+ **Version 2.0** introduces a resource-style client — `dashscope.Client()` — modeled on the ergonomics of the OpenAI SDK: one client holds a shared connection pool, every capability hangs off it as a typed resource (`client.chat`, `client.images`, `client.audio`, …), responses are typed objects instead of raw dicts, and failures raise exceptions by default. The complete 1.x public surface remains available at its historical import paths and is implemented by facades under `dashscope.legacy_1x`; AgentStudio and Agentic RL share their large business cores with 2.0 without sharing public return or error contracts.
89
+
90
+ ## What's new in 2.0
91
+
92
+ | | 1.x | 2.0 |
93
+ |---|---|---|
94
+ | Entry point | Module-level static classes: `Generation.call(...)` | A resource-style client: `client.chat.completions.create(...)` |
95
+ | One-liner | — | `dashscope.chat("qwen-plus", "Tell me a joke")` |
96
+ | Response | Raw dict-like; check `status_code == HTTPStatus.OK` | Typed object; read `resp.output_text`, `resp.usage.total_tokens` |
97
+ | Errors | Inspect `resp.code` / `resp.message` by hand | Typed `DashScopeError` exceptions raised by default *(evolving)* |
98
+ | Streaming | Generator of raw frames | `ChatStream` with `.text_stream`, `.reasoning_stream`, `.get_final_message()` |
99
+ | Protocols | DashScope native + a separate compatible-mode entry | One client speaks `native`, `openai`, or `anthropic` via `protocol=` |
100
+ | Async | Separate `Aio*` classes | `dashscope.AsyncClient()` mirrors the sync surface (except the duplex audio WebSocket sessions) |
101
+ | Connections | A fresh session per call | One keep-alive pool per client, shared across resources |
102
+ | Config | Module globals (`dashscope.api_key`, `set_region`) | Layered: args → `dashscope.settings` → env → `~/.dashscope/config.toml` |
103
+
104
+ ## Installation
105
+
106
+ ```shell
107
+ pip install -U dashscope
108
+ ```
109
+
110
+ The base install covers SDK API calls, the `dashscope` CLI command, Agentic RL fine-tuning and the local tokenizer. Python 3.9+ is required. Optional feature groups all belong to the bundled AI assistant:
111
+
112
+ | Extra | Provides | Install |
113
+ |-------|----------|---------|
114
+ | `acli` | Interactive AI assistant (DashScope SDK Expert) | `pip install "dashscope[acli]"` |
115
+ | `acli-openai` | Run the assistant on an OpenAI-compatible model provider | `pip install "dashscope[acli-openai]"` |
116
+ | `acli-anthropic` | Run the assistant on an Anthropic model provider | `pip install "dashscope[acli-anthropic]"` |
117
+ | `acli-voice` | Voice input and spoken replies in the assistant | `pip install "dashscope[acli-voice]"` |
118
+ | `acli-camera` | Camera capture for image input in the assistant | `pip install "dashscope[acli-camera]"` |
119
+ | `acli-all` | All of the above (includes `acli`) | `pip install "dashscope[acli-all]"` |
120
+
121
+ To install from a source checkout:
122
+
123
+ ```shell
124
+ pip install -e .
125
+ ```
126
+
127
+ ## Quick start
128
+
129
+ Set your API key ([how to get one](https://help.aliyun.com/en/model-studio/get-api-key)):
130
+
131
+ ```shell
132
+ export DASHSCOPE_API_KEY="sk-xxx"
133
+ ```
134
+
135
+ **One line** — the fastest way to a completion:
136
+
137
+ ```python
138
+ import dashscope
139
+
140
+ completion = dashscope.chat("qwen-plus", "Tell me a joke")
141
+ print(completion.output_text)
142
+ ```
143
+
144
+ **Client** — the recommended form for anything real. One client, reused across calls:
145
+
146
+ ```python
147
+ import dashscope
148
+
149
+ client = dashscope.Client() # reads DASHSCOPE_API_KEY
150
+
151
+ resp = client.chat.completions.create(
152
+ model="qwen-plus",
153
+ messages=[
154
+ {"role": "system", "content": "You are a helpful assistant."},
155
+ {"role": "user", "content": "Who are you?"},
156
+ ],
157
+ )
158
+ print(resp.output_text)
159
+ print(resp.usage.total_tokens, "tokens |", resp.request_id)
160
+ ```
161
+
162
+ **Streaming** — `stream=True` returns a `ChatStream`:
163
+
164
+ ```python
165
+ stream = client.chat.completions.create(
166
+ model="qwen-plus",
167
+ messages=[{"role": "user", "content": "Write a haiku about the sea"}],
168
+ stream=True,
169
+ )
170
+ for text in stream.text_stream:
171
+ print(text, end="", flush=True)
172
+
173
+ # Or collapse the whole stream into one merged ChatCompletion (with usage):
174
+ # final = stream.get_final_message()
175
+ ```
176
+
177
+ **Async** — `AsyncClient` mirrors the sync surface:
178
+
179
+ ```python
180
+ import asyncio
181
+ import dashscope
182
+
183
+ async def main():
184
+ client = dashscope.AsyncClient()
185
+ resp = await client.chat.completions.create(
186
+ model="qwen-plus",
187
+ messages=[{"role": "user", "content": "Hello"}],
188
+ )
189
+ print(resp.output_text)
190
+ await client.aclose()
191
+
192
+ asyncio.run(main())
193
+ ```
194
+
195
+ ## Core concepts
196
+
197
+ ### The client
198
+
199
+ `dashscope.Client()` (and `dashscope.AsyncClient()`) is the single entry point. It owns one keep-alive connection pool shared by every resource call, and exposes capabilities as attributes:
200
+
201
+ ```python
202
+ client = dashscope.Client(
203
+ api_key="sk-xxx", # default: DASHSCOPE_API_KEY
204
+ workspace="ws-xxx123", # default: DASHSCOPE_WORKSPACE
205
+ region="cn-beijing", # default: DASHSCOPE_REGION
206
+ protocol="native", # native | openai | anthropic
207
+ timeout=300.0,
208
+ max_retries=2,
209
+ base_url=None, # override the endpoint entirely; default: DASHSCOPE_BASE_URL
210
+ config_path=None, # alternate config.toml; default: DASHSCOPE_CONFIG
211
+ protocol_options=None, # extra kwargs forwarded to the selected protocol adapter
212
+ raise_on_error=True, # False: return error responses instead of raising
213
+ http_client=None, # your own httpx.Client (AsyncClient for AsyncClient)
214
+ )
215
+ ```
216
+
217
+ All options are keyword-only.
218
+
219
+ Use it as a context manager to close the pool automatically, or derive a variant with `with_options()` (unmentioned options are inherited; the connection pool is shared when connection-level options are unchanged):
220
+
221
+ ```python
222
+ with dashscope.Client() as client:
223
+ client.chat.completions.create(model="qwen-plus", messages=["hi"])
224
+
225
+ low_latency = client.with_options(timeout=10.0, max_retries=0)
226
+ ```
227
+
228
+ Any call also accepts per-request `api_key=`, `workspace=`, and `timeout=` overrides.
229
+
230
+ Need proxies, custom connection limits or event hooks? Pass your own `http_client=httpx.Client(...)` (`httpx.AsyncClient` for `AsyncClient`). The SDK still applies authentication, retries and absolute endpoint URLs on top of it, and never closes a client it does not own.
231
+
232
+ ### Protocols
233
+
234
+ One client can speak three wire protocols, selected with `protocol=` (or `DASHSCOPE_PROTOCOL` / `settings.protocol`). The request/response objects stay the same canonical, typed shape regardless of protocol — only the wire format changes:
235
+
236
+ | `protocol` | Talks to | Use when |
237
+ |------------|----------|----------|
238
+ | `native` (default) | DashScope native API (`/api/v1`) | You want the full DashScope feature set |
239
+ | `openai` | OpenAI-compatible mode (`/compatible-mode/v1`) | You're porting OpenAI code — no `openai` package needed |
240
+ | `anthropic` | Anthropic-compatible mode (`/apps/anthropic`) | You're porting Anthropic Messages code |
241
+
242
+ ```python
243
+ client = dashscope.Client(protocol="openai")
244
+ resp = client.chat.completions.create(
245
+ model="qwen-plus",
246
+ messages=[{"role": "user", "content": "Hello"}],
247
+ )
248
+ ```
249
+
250
+ ### Typed responses
251
+
252
+ Every response is a typed object. For chat, read `output_text` for the first choice, or dig into `choices`, `usage`, `search_info`, `request_id`, and `model`:
253
+
254
+ ```python
255
+ resp = client.chat.completions.create(model="qwen-plus", messages=["hi"])
256
+
257
+ resp.output_text # choices[0].message.content
258
+ resp.choices[0].message.content # same, explicit
259
+ resp.choices[0].message.reasoning_content # thinking-model reasoning, if any
260
+ resp.choices[0].message.tool_calls # tool calls, if any
261
+ resp.usage.input_tokens # also .output_tokens / .total_tokens
262
+ resp.request_id
263
+ ```
264
+
265
+ All responses share a common envelope: `request_id`, `status_code`, `code`, `message`, `is_error`, and raw `headers`.
266
+
267
+ ### Streaming
268
+
269
+ `stream=True` returns a `ChatStream` (`AsyncChatStream` for `AsyncClient`) with typed helpers:
270
+
271
+ ```python
272
+ stream = client.chat.completions.create(model="qwen-plus", messages=["hi"], stream=True)
273
+
274
+ for text in stream.text_stream: # content deltas
275
+ ...
276
+ # stream.reasoning_stream # reasoning deltas (thinking models)
277
+ # stream.tool_call_stream # tool-call deltas
278
+ # stream.get_final_message() # merged ChatCompletion, incl. usage
279
+ ```
280
+
281
+ By default each frame is incremental. Pass `incremental_output=False` to receive cumulative snapshots instead (the SDK merges deltas for you).
282
+
283
+ Thinking models surface reasoning on `.reasoning_stream` and, in the merged message, as `message.reasoning_content`. Under `protocol="anthropic"` the SDK also keeps `message.reasoning_signature` plus the raw `thinking` / `redacted_thinking` blocks in `message.reasoning_blocks`, so echoing the assistant message back on the next turn preserves extended thinking.
284
+
285
+ > **Note:** streaming retries stop at the handshake. The SDK retries connection failures and retryable HTTP statuses only *before* the first event reaches you; once a stream is open it is never replayed, so a mid-stream drop surfaces as an exception. Wrap stream consumption in your own retry/backoff for production — see [`examples/04_real_world_scenarios/production_ready_rag_harness.py`](examples/04_real_world_scenarios/production_ready_rag_harness.py).
286
+
287
+ ### Errors
288
+
289
+ > **Still evolving.** The 2.0 typed error surface is under active development — new exception classes may be added and the API-error-code → exception mapping may be refined. Catch the base `errors.DashScopeError` if you need to stay forward-compatible.
290
+
291
+ Failures raise a typed `DashScopeError` by default (both non-2xx HTTP statuses and HTTP-200-with-a-business-error land here):
292
+
293
+ ```python
294
+ from dashscope import errors
295
+
296
+ try:
297
+ client.chat.completions.create(model="qwen-plus", messages=["hi"])
298
+ except errors.RateLimitError as exc:
299
+ print("throttled:", exc.code, exc.status_code, exc.request_id)
300
+ except errors.ContentFilterError as exc:
301
+ print("blocked by moderation:", exc.message)
302
+ except errors.DashScopeError as exc: # base class for all SDK errors
303
+ print("request failed:", exc.code, exc.message)
304
+ ```
305
+
306
+ Everything derives from `DashScopeError`, in two families:
307
+
308
+ - **Server errors** — under `APIStatusError`: `BadRequestError`, `AuthenticationError`, `PermissionDeniedError`, `NotFoundError`, `RequestTooLargeError`, `RateLimitError`, `InternalServerError`, `ServiceUnavailableError`, `GatewayTimeoutError`, and `ContentFilterError` (a `BadRequestError` subclass).
309
+ - **Client-side errors** — under `SdkError`: `APIConnectionError` / `APITimeoutError` for network failures, plus the WebSocket family `WsEventError`, `WsStateError`, `WsQueueCapacityExceededError` and `WsBinaryOwnerConflictError`. Each carries a stable `sdk.*` code.
310
+
311
+ A 200 response whose body does not parse into the expected envelope is reported as `InternalServerError` rather than leaking a decoder exception.
312
+
313
+ Prefer to inspect errors inline instead of catching? Build the client with `raise_on_error=False` — failures come back as a normal response object with `is_error=True`, `code`, `message`, and `status_code`:
314
+
315
+ ```python
316
+ client = dashscope.Client(raise_on_error=False)
317
+ resp = client.chat.completions.create(model="qwen-plus", messages=["hi"])
318
+ if resp.is_error:
319
+ print(resp.code, resp.message)
320
+ ```
321
+
322
+ ## Authentication
323
+
324
+ The SDK authenticates with an API key. Get one from the [Model Studio console](https://help.aliyun.com/en/model-studio/get-api-key). Provide it in any of these ways (highest priority first):
325
+
326
+ 1. **Per client** — `dashscope.Client(api_key="sk-xxx")`
327
+ 2. **Global settings** — `dashscope.settings.api_key = "sk-xxx"` (applies to clients created afterwards)
328
+ 3. **Environment variable** — `export DASHSCOPE_API_KEY="sk-xxx"`
329
+ 4. **Config file** — `api_key` in `~/.dashscope/config.toml`
330
+ 5. **1.x key file** — the file written by `dashscope.save_api_key(...)` (`~/.dashscope/api_key`, or `DASHSCOPE_API_KEY_FILE_PATH`), honored as the lowest tier so existing 1.x setups keep working
331
+
332
+ Any call also accepts a per-request `api_key=` override.
333
+
334
+ > **API keys are region-specific.** Each region issues its own keys; a key from another region fails with `401`. Switch `api_key` together with `region`.
335
+
336
+ ## Configuration
337
+
338
+ Configuration resolves in layers — **explicit arguments → `dashscope.settings` → environment variables → `~/.dashscope/config.toml`**. Set it once at startup, per client, or not at all.
339
+
340
+ **Global settings facade:**
341
+
342
+ ```python
343
+ import dashscope
344
+
345
+ dashscope.settings.api_key = "sk-xxx"
346
+ dashscope.settings.workspace = "ws-xxx123"
347
+ dashscope.settings.region = "ap-southeast-1"
348
+ dashscope.settings.protocol = "openai"
349
+ dashscope.settings.timeout = 60.0
350
+ dashscope.settings.max_retries = 3
351
+ dashscope.settings.log_level = "INFO"
352
+ ```
353
+
354
+ **Environment variables:**
355
+
356
+ | Variable | Sets | Default |
357
+ |----------|------|---------|
358
+ | `DASHSCOPE_API_KEY` | API key | — |
359
+ | `DASHSCOPE_WORKSPACE` | Workspace ID (endpoint subdomain) | — |
360
+ | `DASHSCOPE_REGION` | Region | `cn-beijing` |
361
+ | `DASHSCOPE_PROTOCOL` | `native` / `openai` / `anthropic` | `native` |
362
+ | `DASHSCOPE_BASE_URL` | Override the HTTP endpoint entirely (escape hatch) | — |
363
+ | `DASHSCOPE_HTTP_BASE_URL` | 1.x name for the same override, honored as a fallback | — |
364
+ | `DASHSCOPE_WEBSOCKET_BASE_URL` | Override the WebSocket endpoint | derived from region/workspace |
365
+ | `DASHSCOPE_TIMEOUT` | Request timeout (seconds) | `300` |
366
+ | `DASHSCOPE_MAX_RETRIES` | Automatic retries | `2` |
367
+ | `DASHSCOPE_HTTP_MAX_CONNECTIONS` | Connection-pool size | `100` |
368
+ | `DASHSCOPE_HTTP_MAX_KEEPALIVE_CONNECTIONS` | Keep-alive connections held in the pool | `20` |
369
+ | `DASHSCOPE_HTTP_KEEPALIVE_EXPIRY` | Keep-alive expiry (seconds) | `5.0` |
370
+ | `DASHSCOPE_LOG` | Log level | `WARNING` |
371
+ | `DASHSCOPE_CONFIG` | Path to `config.toml` | `~/.dashscope/config.toml` |
372
+ | `DASHSCOPE_API_KEY_FILE_PATH` | Path to the 1.x key file (lowest-priority auth tier) | `~/.dashscope/api_key` |
373
+
374
+ The three `DASHSCOPE_HTTP_*` pool variables are also settable as `http_max_connections`, `http_max_keepalive_connections` and `http_keepalive_expiry` in `settings` and `config.toml`. Passing your own `http_client=` takes precedence over all of them.
375
+
376
+ **Config file** (`~/.dashscope/config.toml`):
377
+
378
+ ```toml
379
+ api_key = "sk-xxx"
380
+ workspace = "ws-xxx123"
381
+ region = "ap-southeast-1"
382
+ protocol = "native"
383
+ timeout = 300.0
384
+ max_retries = 2
385
+ ```
386
+
387
+ ### Regions and endpoints
388
+
389
+ By default requests go to the China (Beijing) gateway. When a `workspace` is set, endpoints are built from the workspace-scoped MaaS gateway `https://{workspace}.{region}.maas.aliyuncs.com`, with each protocol served under its own path. Point at another region with `region=` (or `DASHSCOPE_REGION` / `settings.region`):
390
+
391
+ ```python
392
+ client = dashscope.Client(region="ap-southeast-1", workspace="ws-xxx123")
393
+ # -> https://ws-xxx123.ap-southeast-1.maas.aliyuncs.com/api/v1
394
+ ```
395
+
396
+ | Region | Location |
397
+ |--------|----------|
398
+ | `cn-beijing` | China (Beijing) — default |
399
+ | `cn-hongkong` | China (Hong Kong) |
400
+ | `ap-southeast-1` | Singapore |
401
+ | `ap-northeast-1` | Japan (Tokyo) |
402
+ | `eu-central-1` | Germany (Frankfurt) |
403
+ | `us-east-1` | US (Virginia) |
404
+
405
+ Notes:
406
+
407
+ - **No workspace configured?** The SDK falls back to the legacy shared gateway (`https://dashscope.aliyuncs.com` for Beijing) and emits a `UserWarning`. It works, but the workspace-scoped gateway is recommended for performance and stability.
408
+ - WebSocket-based realtime APIs (realtime speech, multimodal dialog) are served in `cn-beijing` and `ap-southeast-1`.
409
+ - Batch inference, fine-tuning and application development are currently available in `cn-beijing` and `ap-southeast-1`.
410
+ - `base_url=` (or `DASHSCOPE_BASE_URL`) overrides everything — the escape hatch for custom/private gateways; it does not require a workspace.
411
+ - The 1.x `dashscope.set_region(region, workspace_id)` global still works for the 1.x module-level API.
412
+
413
+ ## Capabilities
414
+
415
+ Every capability is a resource on the client. Sync and async clients expose the same surface (async methods are `await`ed) — with one exception: the duplex WebSocket audio sessions are sync-only by design, as noted below.
416
+
417
+ | Capability | 2.0 resource | Example |
418
+ |------------|--------------|---------|
419
+ | Text chat / generation | `client.chat.completions.create(...)` | [`text_generation/chat.py`](examples/01_atomic_capabilities/text_generation/chat.py) |
420
+ | Multi-modal chat (vision, video) | `client.multimodal.chat.create(...)` | [`multimodal_vision/multimodal_chat.py`](examples/01_atomic_capabilities/multimodal_vision/multimodal_chat.py) |
421
+ | Text embedding | `client.embeddings.create(...)` (+ `.jobs` for batch) | [`embeddings/embeddings.py`](examples/01_atomic_capabilities/embeddings/embeddings.py) |
422
+ | Multi-modal embedding | `client.multimodal.embeddings.create(...)` | [`embeddings/`](examples/01_atomic_capabilities/embeddings/) |
423
+ | Rerank | `client.rerank.create(...)` | [`rerank/rerank.py`](examples/01_atomic_capabilities/rerank/rerank.py) |
424
+ | Decision (System One) | `client.decision.create(...)` | [`decision/decision.py`](examples/01_atomic_capabilities/decision/decision.py) |
425
+ | Token counting | `client.tokenization.count(...)` | [`text_generation/tokenization.py`](examples/01_atomic_capabilities/text_generation/tokenization.py) |
426
+ | Image generation | `client.images.generate(...)` (+ `.jobs`) | [`image_video_synthesis/images.py`](examples/01_atomic_capabilities/image_video_synthesis/images.py) |
427
+ | Video generation | `client.videos.generate(...)` (+ `.jobs`) | [`image_video_synthesis/videos.py`](examples/01_atomic_capabilities/image_video_synthesis/videos.py) |
428
+ | Speech recognition (ASR) | Batch `client.audio.asr.transcribe(...)` / `.jobs`; realtime `client.audio.asr.recognize(...)` | [`audio/asr_file.py`](examples/01_atomic_capabilities/audio/asr_file.py) · [`audio/asr_websocket.py`](examples/01_atomic_capabilities/audio/asr_websocket.py) |
429
+ | Speech synthesis (TTS) | HTTP `client.audio.tts.http.synthesize(...)` / `.stream(...)`; WebSocket `client.audio.tts.connect(...)` | [`audio/tts_http.py`](examples/01_atomic_capabilities/audio/tts_http.py) · [`audio/tts_websocket.py`](examples/01_atomic_capabilities/audio/tts_websocket.py) |
430
+ | Realtime omni dialog | `client.audio.realtime.connect(...)` | [`audio/realtime_omni.py`](examples/01_atomic_capabilities/audio/realtime_omni.py) |
431
+ | Voice & vocabulary management | `client.audio.voices` · `.voice_design` · `.vocabularies` · `.phrases` | [`audio/voice_clone.py`](examples/01_atomic_capabilities/audio/voice_clone.py) |
432
+ | Meeting & audio understanding (TingWu) | `client.tingwu.call(...)` / `.realtime(...)` | [`audio/tingwu.py`](examples/01_atomic_capabilities/audio/tingwu.py) |
433
+ | Files | `client.files.upload/list/get/delete(...)` | [`files/files.py`](examples/01_atomic_capabilities/files/files.py) |
434
+ | Models | `client.models.list/get(...)` | [`models/models.py`](examples/01_atomic_capabilities/models/models.py) |
435
+ | Fine-tuning | `client.fine_tunes.create/get/list/wait/cancel/delete(...)` | [`fine_tuning/fine_tunes.py`](examples/01_atomic_capabilities/fine_tuning/fine_tunes.py) |
436
+ | Model deployments | `client.deployments.create/scale/list/delete(...)` | [`fine_tuning/`](examples/01_atomic_capabilities/fine_tuning/) |
437
+ | Agentic RL | `client.rl` (`.jobs`, `register_functions`, `upload_data`) | [`fine_tuning/reinforcement_learning.py`](examples/01_atomic_capabilities/fine_tuning/reinforcement_learning.py) |
438
+ | Model Studio applications | `client.apps.completions.create(...)` | [`applications/apps.py`](examples/01_atomic_capabilities/applications/apps.py) |
439
+ | AgentStudio (agents, sessions, memory) | `client.agentstudio` | [`03_agent_recipes/agentstudio.py`](examples/03_agent_recipes/agentstudio.py) |
440
+
441
+ A few common shapes:
442
+
443
+ ```python
444
+ # Embeddings
445
+ resp = client.embeddings.create(model="text-embedding-v4", input=["hello", "world"], dimension=1024)
446
+ resp.embeddings[0].embedding
447
+
448
+ # Multi-modal chat (image understanding)
449
+ resp = client.multimodal.chat.create(
450
+ model="qwen3-vl-plus",
451
+ messages=[{"role": "user", "content": [{"image": "https://.../cat.png"}, {"text": "What is this?"}]}],
452
+ )
453
+ resp.output_text
454
+
455
+ # Image generation (submit + wait); use client.images.jobs for manual control
456
+ job = client.images.generate(model="wanx2.1-t2i-turbo", prompt="a cozy flower shop", size="1024*1024")
457
+ if job.succeeded:
458
+ print(job.image_urls)
459
+
460
+ # HTTP speech synthesis: one POST, audio comes back as a temporary URL
461
+ synth = client.audio.tts.http.synthesize(
462
+ "Hello there", model="cosyvoice-v3-flash", voice="longanhuan", format="pcm",
463
+ )
464
+ print(synth.audio_url)
465
+
466
+ # Streaming synthesis yields audio chunks as they are rendered
467
+ for chunk in client.audio.tts.http.stream(
468
+ "Hello there", model="cosyvoice-v3-flash", voice="longanhuan", format="pcm",
469
+ ):
470
+ if chunk.audio:
471
+ ... # chunk.is_final marks the closing part
472
+
473
+ # A Model Studio application
474
+ resp = client.apps.completions.create(app_id="YOUR_APP_ID", prompt="How do I make stew?")
475
+ resp.text
476
+ ```
477
+
478
+ ### Async audio
479
+
480
+ `AsyncClient` covers the HTTP-shaped audio resources — `await client.audio.asr.transcribe(...)` for batch transcription, `client.audio.tts.http.synthesize/.stream` for synthesis, and the management resources (`voices`, `voice_design`, `vocabularies`, `phrases`). The duplex WebSocket sessions (`asr.recognize`, `tts.connect`, `realtime.connect`) are sync-only by design; run them in a thread if you need them inside an async app.
481
+
482
+ ### Realtime over one WebSocket
483
+
484
+ For latency-sensitive realtime audio, open a shared duplex socket and run multiple sessions on it instead of handshaking per task:
485
+
486
+ ```python
487
+ connection = client.ws_connection()
488
+ session = client.audio.asr.recognize(model="fun-asr-realtime", connection=connection)
489
+ # ... drive the session; the caller owns the connection ...
490
+ connection.close()
491
+ ```
492
+
493
+ Each task on the connection reads through a bounded queue (`task_queue_size=`, default 1024), so a slow consumer fails its own task with `errors.WsQueueCapacityExceededError` instead of holding audio in memory indefinitely or tearing down the shared socket.
494
+
495
+ ## Supported models
496
+
497
+ | Category | Example models | 2.0 resource |
498
+ |----------|----------------|--------------|
499
+ | Text generation | qwen-max, qwen-plus, qwen-turbo | `client.chat` |
500
+ | Multi-modal understanding | qwen3-vl-plus, qwen-omni | `client.multimodal.chat` |
501
+ | Text embedding | text-embedding-v4, text-embedding-v3 | `client.embeddings` |
502
+ | Multi-modal embedding | tongyi-embedding-vision-plus | `client.multimodal.embeddings` |
503
+ | Rerank | gte-rerank-v2, qwen3-rerank | `client.rerank` |
504
+ | Image generation | wanx2.1-t2i-turbo, wan2.6-image | `client.images` |
505
+ | Video generation | wanx2.1-t2v, wan2.7-i2v | `client.videos` |
506
+ | Speech synthesis (TTS) | cosyvoice-v3-flash, cosyvoice-v1, qwen-tts | `client.audio.tts` |
507
+ | Speech recognition (ASR) | fun-asr-realtime, paraformer-v1 | `client.audio.asr` |
508
+ | Omni (realtime) | qwen-omni-turbo-realtime | `client.audio.realtime` |
509
+
510
+ For the latest model list, visit the [Model Studio model plaza](https://bailian.console.aliyun.com/).
511
+
512
+ ## AI Assistant: DashScope SDK Expert
513
+
514
+ The SDK ships with an interactive AI assistant, **DashScope SDK Expert**, built on the bundled Agentic CLI (`dashscope/acli`). It answers SDK/API questions, generates runnable examples, shows CLI usage, and diagnoses errors right in your terminal.
515
+
516
+ - Run `dashscope` with no arguments to start the assistant. On first run it offers to install the knowledge pack (per-domain quick-reference skills: text, multimodal, speech, retrieval, fine-tuning, agent, cli), so guidance comes from the SDK's public interfaces — parameters, outputs, error codes — without reading the source.
517
+ - Ask it instead of reading docs — e.g. `dashscope expert "how do I stream chat output"` (asks once and exits). Type `/help` inside the assistant for available commands; `dashscope expert --help` shows all forms.
518
+ - Install with the `acli` extra: `pip install "dashscope[acli]"`. Add `acli-voice` / `acli-camera` for voice and camera input, or `acli-all` for everything — see the [extras table](#installation).
519
+ - Full walkthrough: [DashScope SDK Expert guide](https://help.aliyun.com/en/model-studio/dashscope-sdk-expert).
520
+
521
+ ## Shell completion
522
+
523
+ Run the command for your shell once, then restart the shell (or re-source your config):
524
+
525
+ | Shell | Install command |
526
+ |-------|-----------------|
527
+ | **bash** | `dashscope --install-completion bash` |
528
+ | **zsh** | `dashscope --install-completion zsh` |
529
+ | **fish** | `dashscope --install-completion fish` |
530
+
531
+ Preview the script without installing:
532
+
533
+ ```shell
534
+ dashscope --show-completion bash
535
+ ```
536
+
537
+ ## Logging
538
+
539
+ Set the level via settings or the environment:
540
+
541
+ ```python
542
+ dashscope.settings.log_level = "INFO"
543
+ ```
544
+
545
+ ```shell
546
+ export DASHSCOPE_LOG="INFO"
547
+ ```
548
+
549
+ ## Examples
550
+
551
+ The [`examples/`](examples/) directory is a production best-practices collection built on the 2.0 client, organized as an advancement path:
552
+
553
+ ```
554
+ examples/
555
+ ├── 01_atomic_capabilities/ Minimal runnable quickref per capability
556
+ ├── 02_advanced_engineering/ Mock debugging, semantic cache, circuit breaker + multi-region DR
557
+ ├── 03_agent_recipes/ Tool-call loop, RAG, MCP server, AgentStudio
558
+ ├── 04_real_world_scenarios/ End-to-end production harnesses (RAG, realtime meetings, customer service)
559
+ └── legacy_1x/ 1.x module-level API examples, for reference
560
+ ```
561
+
562
+ See [`examples/README.md`](examples/README.md). Several flagship cases run fully offline (mock transports) with no API key.
563
+
564
+ ## Migrating from 1.x
565
+
566
+ The 1.x module-level API is unchanged and still supported — you can adopt 2.0 incrementally. When you're ready, the mapping is direct:
567
+
568
+ | 1.x | 2.0 |
569
+ |-----|-----|
570
+ | `Generation.call(model=..., messages=..., result_format="message")` | `client.chat.completions.create(model=..., messages=...)` |
571
+ | `resp.status_code == HTTPStatus.OK` then `resp.output.choices[0].message.content` | `resp.output_text` (errors raise by default) |
572
+ | `MultiModalConversation.call(...)` | `client.multimodal.chat.create(...)` |
573
+ | `TextEmbedding.call(...)` | `client.embeddings.create(...)` |
574
+ | `TextReRank.call(...)` | `client.rerank.create(...)` |
575
+ | `ImageSynthesis.call(...)` / `.async_call(...)` | `client.images.generate(...)` / `client.images.jobs` |
576
+ | `dashscope.api_key = "sk-xxx"` | `dashscope.Client(api_key=...)` or `dashscope.settings.api_key = ...` |
577
+ | `dashscope.set_region(region, workspace_id)` | `dashscope.Client(region=..., workspace=...)` |
578
+ | OpenAI-compatible via `dashscope.aigc.chat_completion.Completions` | `dashscope.Client(protocol="openai")` |
579
+
580
+ ### Package layout and compatibility
581
+
582
+ The 2.0 implementation sits directly under `dashscope`; the former `dashscope.v2` namespace is gone. AgentStudio and FineTune/Agentic RL each have a single business core under `dashscope.applications`, with two thin public facades on top:
583
+
584
+ - the historical `dashscope.agentstudio` and `dashscope.finetune.agentic_rl` imports keep the 1.x clients, methods, return models and exception classes;
585
+ - `client.agentstudio` and `client.rl` expose the 2.0 resource APIs, the httpx transport and the `dashscope.errors` family.
586
+
587
+ Historical deep modules such as `dashscope.aigc`, `dashscope.client.base_api`, `dashscope.files` and `dashscope.tokenizers` remain importable through lazy aliases to `dashscope.legacy_1x`. The local `get_tokenizer` utility therefore keeps its 1.x exception contract, while 2.0 remote token counting is the independent `client.tokenization` resource. The application cores are internal implementation paths — 2.0 callers should use the client resource tree.
588
+
589
+ Concretely: the historical Agentic RL class still returns `FineTune` from `submit_job` and retains `cancel/list/get/delete/logs`, whereas the 2.0 job lifecycle is `client.rl.jobs` with errors from the SDK catalog. Likewise, standalone `dashscope.agentstudio.Client` keeps the old `AgentStudioError` hierarchy and its `raw` response attribute, while `client.agentstudio` raises `dashscope.errors` and exposes failed response data through `body`.
590
+
591
+ > **Breaking (2.0 AgentStudio errors):** on the 2.0 surface — `client.agentstudio`, whose exceptions come from `dashscope.applications.agentstudio` — `ConflictError` is an alias of `APIStatusError` rather than a 409-specific subclass, so `except ConflictError` catches *every* status error (400/401/404/429/5xx), not just conflicts. Match on `err.status_code == 409` if you need conflict-only handling. The historical `dashscope.agentstudio.ConflictError` is untouched and still 409-specific.
592
+
593
+ > **Breaking (`submit_job` / realtime WebSocket):** `submit_job` forwards extra keyword arguments straight to the transport, so the 1.x `request_timeout=` is renamed `timeout=`, and `workspace=` / `headers=` / `stream=` are no longer accepted (passing any of them raises `TypeError`). The realtime WebSocket errors (`WsStateError`, `WsQueueCapacityExceededError`, `WsBinaryOwnerConflictError`) now derive from `DashScopeError` instead of `RuntimeError`, so a bare `except RuntimeError` no longer catches them — catch `errors.DashScopeError` (or the specific class) instead.
594
+
595
+ `dashscope.save_api_key` now comes from `dashscope._config`. It accepts an optional key-file path, expands `~`, creates missing parent directories, and writes UTF-8. Logs from the current client use the independent `dashscope._logging` logger hierarchy and do not reconfigure the shared `dashscope` root logger.
596
+
597
+ ### Development tests
598
+
599
+ ```bash
600
+ python -m pytest tests --ignore=tests/legacy_1x -q # current
601
+ python -m pytest tests/legacy_1x -q # archived compatibility
602
+ python -m pytest tests -q # everything
603
+ ```
604
+
605
+ For current coverage, run `coverage run -m pytest tests --ignore=tests/legacy_1x`, then `coverage report -m`.
606
+
607
+ ## License
608
+
609
+ This project is licensed under the Apache License (Version 2.0).