dashscope 1.27.7__tar.gz → 2.0.1__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 (522) hide show
  1. {dashscope-1.27.7 → dashscope-2.0.1}/MANIFEST.in +1 -0
  2. dashscope-2.0.1/PKG-INFO +532 -0
  3. dashscope-2.0.1/README.md +452 -0
  4. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/__init__.py +50 -17
  5. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/__init__.pyi +9 -0
  6. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/__init__.py +1 -1
  7. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/agent.py +357 -46
  8. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/cli/constants.py +1 -0
  9. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/cli/dispatch.py +7 -0
  10. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/cli/handlers_provider.py +54 -0
  11. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/cli/repl.py +9 -0
  12. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/cli/runners.py +68 -1
  13. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/cli/streaming.py +10 -1
  14. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/commands.py +5 -0
  15. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/config.py +1 -0
  16. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/examples/basic-chat/.acli/custom-extensions.toml +14 -14
  17. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/examples/basic-chat/README.md +2 -2
  18. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/examples/dashscope-sdk-expert/.acli/custom-extensions.toml +4 -4
  19. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/agent.md +1 -1
  20. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/cli.md +9 -9
  21. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/fine-tuning.md +1 -1
  22. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/multimodal.md +6 -6
  23. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/text-generation.md +6 -6
  24. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/examples/dashscope-sdk-expert/.acli/system-prompt.md +18 -0
  25. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/executor.py +22 -5
  26. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/memory/directives_learning.py +54 -44
  27. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/memory/experience.py +8 -1
  28. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/memory/reflection.py +113 -1
  29. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/memory/skill_evolution.py +32 -26
  30. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/memory/tool_chains.py +2 -2
  31. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/memory/trace.py +12 -1
  32. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/prompt_pipeline.py +6 -1
  33. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/providers/hardening.py +34 -0
  34. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/providers/tongyi.py +75 -1
  35. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/skills/__init__.py +2 -0
  36. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/skills/base.py +70 -16
  37. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/tools/checkpoint.py +69 -16
  38. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/tools/evolution.py +9 -1
  39. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/tools/filesystem.py +42 -1
  40. dashscope-2.0.1/dashscope/acli/tools/registry.py +480 -0
  41. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/tools/shell.py +156 -1
  42. dashscope-2.0.1/dashscope/acli/tools/vision.py +674 -0
  43. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/utils/crypto.py +24 -3
  44. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/utils/paths.py +6 -2
  45. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/agentstudio/__init__.py +6 -0
  46. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/agentstudio/client.py +6 -0
  47. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/agentstudio/pagination.py +40 -3
  48. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/agentstudio/resources/__init__.py +14 -0
  49. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/agentstudio/resources/_helpers.py +47 -0
  50. dashscope-2.0.1/dashscope/agentstudio/resources/memory_stores.py +790 -0
  51. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/agentstudio/types/__init__.py +10 -0
  52. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/agentstudio/types/models.py +91 -0
  53. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/agentstudio/types/params.py +136 -0
  54. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/api_entities/api_request_factory.py +4 -1
  55. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/api_entities/encryption.py +14 -8
  56. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/cli/__init__.py +4 -4
  57. dashscope-2.0.1/dashscope/common/_sdk_session.py +43 -0
  58. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/common/utils.py +5 -2
  59. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/embeddings/text_embedding.py +1 -0
  60. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/__init__.py +2 -2
  61. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/common/constants.py +1 -1
  62. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/data/base_data_model.py +2 -3
  63. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/data/group_reward_input.py +2 -3
  64. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/data/group_reward_output.py +2 -3
  65. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/data/reward_input.py +2 -3
  66. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/data/reward_output.py +2 -3
  67. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/data/rollout_input.py +2 -3
  68. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/data/rollout_output.py +2 -3
  69. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/observability/processor_span.py +3 -6
  70. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/observability/tracing.py +5 -6
  71. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/rerank/text_rerank.py +1 -0
  72. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/utils/oss_utils.py +7 -0
  73. dashscope-2.0.1/dashscope/v2/__init__.py +40 -0
  74. dashscope-2.0.1/dashscope/v2/_config.py +734 -0
  75. dashscope-2.0.1/dashscope/v2/_error_registry.py +650 -0
  76. dashscope-2.0.1/dashscope/v2/_logging.py +138 -0
  77. dashscope-2.0.1/dashscope/v2/_quickstart.py +38 -0
  78. dashscope-2.0.1/dashscope/v2/client.py +492 -0
  79. dashscope-2.0.1/dashscope/v2/errors.py +462 -0
  80. dashscope-2.0.1/dashscope/v2/protocols/__init__.py +49 -0
  81. dashscope-2.0.1/dashscope/v2/protocols/anthropic.py +702 -0
  82. dashscope-2.0.1/dashscope/v2/protocols/base.py +127 -0
  83. dashscope-2.0.1/dashscope/v2/protocols/native.py +176 -0
  84. dashscope-2.0.1/dashscope/v2/protocols/openai.py +265 -0
  85. dashscope-2.0.1/dashscope/v2/resources/__init__.py +3 -0
  86. dashscope-2.0.1/dashscope/v2/resources/_agentstudio.py +384 -0
  87. dashscope-2.0.1/dashscope/v2/resources/_jobs.py +625 -0
  88. dashscope-2.0.1/dashscope/v2/resources/_oss.py +230 -0
  89. dashscope-2.0.1/dashscope/v2/resources/_sse.py +78 -0
  90. dashscope-2.0.1/dashscope/v2/resources/apps.py +572 -0
  91. dashscope-2.0.1/dashscope/v2/resources/audio/__init__.py +101 -0
  92. dashscope-2.0.1/dashscope/v2/resources/audio/_callbacks.py +70 -0
  93. dashscope-2.0.1/dashscope/v2/resources/audio/asr.py +684 -0
  94. dashscope-2.0.1/dashscope/v2/resources/audio/customization.py +586 -0
  95. dashscope-2.0.1/dashscope/v2/resources/audio/http_tts.py +447 -0
  96. dashscope-2.0.1/dashscope/v2/resources/audio/phrases.py +254 -0
  97. dashscope-2.0.1/dashscope/v2/resources/audio/realtime.py +855 -0
  98. dashscope-2.0.1/dashscope/v2/resources/audio/tts.py +425 -0
  99. dashscope-2.0.1/dashscope/v2/resources/chat/__init__.py +39 -0
  100. dashscope-2.0.1/dashscope/v2/resources/chat/completions.py +996 -0
  101. dashscope-2.0.1/dashscope/v2/resources/decision.py +287 -0
  102. dashscope-2.0.1/dashscope/v2/resources/deployments.py +455 -0
  103. dashscope-2.0.1/dashscope/v2/resources/embeddings.py +429 -0
  104. dashscope-2.0.1/dashscope/v2/resources/files.py +386 -0
  105. dashscope-2.0.1/dashscope/v2/resources/fine_tunes.py +691 -0
  106. dashscope-2.0.1/dashscope/v2/resources/images.py +812 -0
  107. dashscope-2.0.1/dashscope/v2/resources/models.py +228 -0
  108. dashscope-2.0.1/dashscope/v2/resources/multimodal/__init__.py +31 -0
  109. dashscope-2.0.1/dashscope/v2/resources/multimodal/chat.py +333 -0
  110. dashscope-2.0.1/dashscope/v2/resources/multimodal/embeddings.py +244 -0
  111. dashscope-2.0.1/dashscope/v2/resources/reinforcement_learning.py +897 -0
  112. dashscope-2.0.1/dashscope/v2/resources/rerank.py +168 -0
  113. dashscope-2.0.1/dashscope/v2/resources/tingwu.py +340 -0
  114. dashscope-2.0.1/dashscope/v2/resources/tokenization.py +142 -0
  115. dashscope-2.0.1/dashscope/v2/resources/videos.py +591 -0
  116. dashscope-2.0.1/dashscope/v2/transport/__init__.py +11 -0
  117. dashscope-2.0.1/dashscope/v2/transport/_ident.py +91 -0
  118. dashscope-2.0.1/dashscope/v2/transport/_retry.py +54 -0
  119. dashscope-2.0.1/dashscope/v2/transport/http.py +466 -0
  120. dashscope-2.0.1/dashscope/v2/transport/sse.py +156 -0
  121. dashscope-2.0.1/dashscope/v2/transport/ws.py +357 -0
  122. dashscope-2.0.1/dashscope/v2/transport/ws_connection.py +468 -0
  123. dashscope-2.0.1/dashscope/v2/types/__init__.py +49 -0
  124. dashscope-2.0.1/dashscope/v2/types/common.py +198 -0
  125. dashscope-2.0.1/dashscope/v2/types/completions.py +170 -0
  126. dashscope-2.0.1/dashscope/v2/types/messages.py +241 -0
  127. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/version.py +1 -1
  128. dashscope-2.0.1/dashscope.egg-info/PKG-INFO +532 -0
  129. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope.egg-info/SOURCES.txt +153 -1
  130. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope.egg-info/requires.txt +9 -13
  131. dashscope-2.0.1/examples/01_atomic_capabilities/applications/apps.py +49 -0
  132. dashscope-2.0.1/examples/01_atomic_capabilities/audio/README.md +220 -0
  133. dashscope-2.0.1/examples/01_atomic_capabilities/audio/_common.py +121 -0
  134. dashscope-2.0.1/examples/01_atomic_capabilities/audio/asr_file.py +215 -0
  135. dashscope-2.0.1/examples/01_atomic_capabilities/audio/asr_http_stream.py +142 -0
  136. dashscope-2.0.1/examples/01_atomic_capabilities/audio/asr_microphone.py +164 -0
  137. dashscope-2.0.1/examples/01_atomic_capabilities/audio/asr_websocket.py +210 -0
  138. dashscope-2.0.1/examples/01_atomic_capabilities/audio/connection_reuse.py +234 -0
  139. dashscope-2.0.1/examples/01_atomic_capabilities/audio/direct_call/_common.py +130 -0
  140. dashscope-2.0.1/examples/01_atomic_capabilities/audio/direct_call/asr_file.py +232 -0
  141. dashscope-2.0.1/examples/01_atomic_capabilities/audio/direct_call/asr_http_stream.py +153 -0
  142. dashscope-2.0.1/examples/01_atomic_capabilities/audio/direct_call/asr_microphone.py +175 -0
  143. dashscope-2.0.1/examples/01_atomic_capabilities/audio/direct_call/asr_websocket.py +224 -0
  144. dashscope-2.0.1/examples/01_atomic_capabilities/audio/direct_call/connection_reuse.py +263 -0
  145. dashscope-2.0.1/examples/01_atomic_capabilities/audio/direct_call/realtime_omni.py +225 -0
  146. dashscope-2.0.1/examples/01_atomic_capabilities/audio/direct_call/realtime_qwen_audio.py +222 -0
  147. dashscope-2.0.1/examples/01_atomic_capabilities/audio/direct_call/realtime_translation.py +226 -0
  148. dashscope-2.0.1/examples/01_atomic_capabilities/audio/direct_call/tts_http.py +180 -0
  149. dashscope-2.0.1/examples/01_atomic_capabilities/audio/direct_call/tts_http_stream.py +145 -0
  150. dashscope-2.0.1/examples/01_atomic_capabilities/audio/direct_call/tts_websocket.py +197 -0
  151. dashscope-2.0.1/examples/01_atomic_capabilities/audio/direct_call/voice_clone.py +283 -0
  152. dashscope-2.0.1/examples/01_atomic_capabilities/audio/realtime_omni.py +198 -0
  153. dashscope-2.0.1/examples/01_atomic_capabilities/audio/realtime_qwen_audio.py +196 -0
  154. dashscope-2.0.1/examples/01_atomic_capabilities/audio/realtime_translation.py +200 -0
  155. dashscope-2.0.1/examples/01_atomic_capabilities/audio/tingwu.py +83 -0
  156. dashscope-2.0.1/examples/01_atomic_capabilities/audio/tts_http.py +165 -0
  157. dashscope-2.0.1/examples/01_atomic_capabilities/audio/tts_http_stream.py +134 -0
  158. dashscope-2.0.1/examples/01_atomic_capabilities/audio/tts_websocket.py +180 -0
  159. dashscope-2.0.1/examples/01_atomic_capabilities/audio/voice_clone.py +277 -0
  160. dashscope-2.0.1/examples/01_atomic_capabilities/decision/decision.py +107 -0
  161. dashscope-2.0.1/examples/01_atomic_capabilities/embeddings/embeddings.py +45 -0
  162. dashscope-2.0.1/examples/01_atomic_capabilities/files/files.py +67 -0
  163. dashscope-2.0.1/examples/01_atomic_capabilities/fine_tuning/fine_tunes.py +71 -0
  164. dashscope-2.0.1/examples/01_atomic_capabilities/fine_tuning/reinforcement_learning.py +83 -0
  165. dashscope-2.0.1/examples/01_atomic_capabilities/image_video_synthesis/images.py +74 -0
  166. dashscope-2.0.1/examples/01_atomic_capabilities/image_video_synthesis/videos.py +66 -0
  167. dashscope-2.0.1/examples/01_atomic_capabilities/models/models.py +43 -0
  168. dashscope-2.0.1/examples/01_atomic_capabilities/multimodal_vision/multimodal_chat.py +60 -0
  169. dashscope-2.0.1/examples/01_atomic_capabilities/rerank/rerank.py +49 -0
  170. dashscope-2.0.1/examples/01_atomic_capabilities/text_generation/chat.py +65 -0
  171. dashscope-2.0.1/examples/01_atomic_capabilities/text_generation/tokenization.py +46 -0
  172. dashscope-2.0.1/examples/02_advanced_engineering/circuit_breaker_retry.py +217 -0
  173. dashscope-2.0.1/examples/02_advanced_engineering/client_side_cache.py +109 -0
  174. dashscope-2.0.1/examples/02_advanced_engineering/local_mock_debugging.py +116 -0
  175. dashscope-2.0.1/examples/03_agent_recipes/agentstudio.py +138 -0
  176. dashscope-2.0.1/examples/03_agent_recipes/agentstudio_deployments.py +43 -0
  177. dashscope-2.0.1/examples/03_agent_recipes/mcp_server_demo/README.md +108 -0
  178. dashscope-2.0.1/examples/03_agent_recipes/mcp_server_demo/client_demo.py +125 -0
  179. dashscope-2.0.1/examples/03_agent_recipes/mcp_server_demo/server.py +157 -0
  180. dashscope-2.0.1/examples/03_agent_recipes/rag_expert_system.py +116 -0
  181. dashscope-2.0.1/examples/03_agent_recipes/tool_call_loop.py +160 -0
  182. dashscope-2.0.1/examples/04_real_world_scenarios/README.md +192 -0
  183. dashscope-2.0.1/examples/04_real_world_scenarios/README_zh.md +192 -0
  184. dashscope-2.0.1/examples/04_real_world_scenarios/customer_service_assistant.py +366 -0
  185. dashscope-2.0.1/examples/04_real_world_scenarios/production_ready_rag_harness.py +717 -0
  186. dashscope-2.0.1/examples/04_real_world_scenarios/realtime_audio_meeting_harness.py +541 -0
  187. dashscope-2.0.1/examples/04_real_world_scenarios/ticket_triage_harness.py +493 -0
  188. dashscope-2.0.1/examples/README.md +159 -0
  189. dashscope-2.0.1/examples/README_zh.md +159 -0
  190. dashscope-2.0.1/examples/legacy_1x/aio_generation/basic.py +48 -0
  191. dashscope-2.0.1/examples/legacy_1x/aio_generation/custom_session.py +96 -0
  192. dashscope-2.0.1/examples/legacy_1x/aio_generation/deep_research.py +165 -0
  193. dashscope-2.0.1/examples/legacy_1x/aio_generation/reasoning.py +46 -0
  194. dashscope-2.0.1/examples/legacy_1x/aio_generation/tool_calls.py +74 -0
  195. dashscope-2.0.1/examples/legacy_1x/aio_image_synthesis.py +84 -0
  196. dashscope-2.0.1/examples/legacy_1x/aio_multimodal_conversation/asr.py +49 -0
  197. dashscope-2.0.1/examples/legacy_1x/aio_multimodal_conversation/image.py +65 -0
  198. dashscope-2.0.1/examples/legacy_1x/aio_multimodal_conversation/ocr.py +79 -0
  199. dashscope-2.0.1/examples/legacy_1x/aio_multimodal_conversation/tool_calls.py +79 -0
  200. dashscope-2.0.1/examples/legacy_1x/aio_video_synthesis.py +74 -0
  201. dashscope-2.0.1/examples/legacy_1x/application.py +42 -0
  202. dashscope-2.0.1/examples/legacy_1x/assistant_api.py +80 -0
  203. dashscope-2.0.1/examples/legacy_1x/assistant_api_file.py +31 -0
  204. dashscope-2.0.1/examples/legacy_1x/assistant_api_simple.py +66 -0
  205. dashscope-2.0.1/examples/legacy_1x/cv_models.py +50 -0
  206. dashscope-2.0.1/examples/legacy_1x/generation/basic.py +73 -0
  207. dashscope-2.0.1/examples/legacy_1x/generation/custom_session.py +80 -0
  208. dashscope-2.0.1/examples/legacy_1x/generation/deep_research.py +160 -0
  209. dashscope-2.0.1/examples/legacy_1x/generation/reasoning.py +41 -0
  210. dashscope-2.0.1/examples/legacy_1x/generation/tool_calls.py +69 -0
  211. dashscope-2.0.1/examples/legacy_1x/image_generation.py +103 -0
  212. dashscope-2.0.1/examples/legacy_1x/image_synthesis.py +49 -0
  213. dashscope-2.0.1/examples/legacy_1x/multimodal_conversation/asr.py +44 -0
  214. dashscope-2.0.1/examples/legacy_1x/multimodal_conversation/image.py +59 -0
  215. dashscope-2.0.1/examples/legacy_1x/multimodal_conversation/ocr.py +74 -0
  216. dashscope-2.0.1/examples/legacy_1x/multimodal_conversation/reasoning.py +44 -0
  217. dashscope-2.0.1/examples/legacy_1x/multimodal_conversation/tool_calls.py +73 -0
  218. dashscope-2.0.1/examples/legacy_1x/multimodal_conversation/video.py +46 -0
  219. dashscope-2.0.1/examples/legacy_1x/multimodal_embedding.py +54 -0
  220. dashscope-2.0.1/examples/legacy_1x/qwen_asr.py +41 -0
  221. dashscope-2.0.1/examples/legacy_1x/qwen_tts.py +49 -0
  222. dashscope-2.0.1/examples/legacy_1x/set_region_example.py +126 -0
  223. dashscope-2.0.1/examples/legacy_1x/text_rerank.py +35 -0
  224. dashscope-2.0.1/examples/legacy_1x/tingwu_realtime.py +150 -0
  225. dashscope-2.0.1/examples/legacy_1x/tingwu_usages.py +28 -0
  226. dashscope-2.0.1/examples/legacy_1x/video_synthesis.py +148 -0
  227. dashscope-2.0.1/requirements.txt +17 -0
  228. {dashscope-1.27.7 → dashscope-2.0.1}/setup.py +34 -10
  229. dashscope-1.27.7/PKG-INFO +0 -315
  230. dashscope-1.27.7/README.md +0 -233
  231. dashscope-1.27.7/dashscope/acli/tools/registry.py +0 -455
  232. dashscope-1.27.7/dashscope/acli/tools/vision.py +0 -263
  233. dashscope-1.27.7/dashscope.egg-info/PKG-INFO +0 -315
  234. dashscope-1.27.7/requirements.txt +0 -10
  235. {dashscope-1.27.7 → dashscope-2.0.1}/LICENSE +0 -0
  236. {dashscope-1.27.7 → dashscope-2.0.1}/LICENSE.certifi +0 -0
  237. {dashscope-1.27.7 → dashscope-2.0.1}/NOTICE +0 -0
  238. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/__main__.py +0 -0
  239. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/acceptance.py +0 -0
  240. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/agents/__init__.py +0 -0
  241. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/agents/delegate.py +0 -0
  242. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/agents/subagent.py +0 -0
  243. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/agents/subagents.py +0 -0
  244. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/audit.py +0 -0
  245. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/capabilities/__init__.py +0 -0
  246. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/capabilities/local_memory.py +0 -0
  247. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/cli/__init__.py +0 -0
  248. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/cli/completer.py +0 -0
  249. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/cli/examples.py +0 -0
  250. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/cli/handlers_capability.py +0 -0
  251. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/cli/handlers_config.py +0 -0
  252. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/cli/handlers_device.py +0 -0
  253. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/cli/handlers_key.py +0 -0
  254. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/cli/handlers_misc.py +0 -0
  255. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/cli/handlers_profile.py +0 -0
  256. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/cli/handlers_session.py +0 -0
  257. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/cli/handlers_setup.py +0 -0
  258. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/cli/handlers_skill.py +0 -0
  259. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/cli/mcp.py +0 -0
  260. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/cli/multimodal.py +0 -0
  261. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/cli/startup.py +0 -0
  262. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/compression.py +0 -0
  263. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/debuglog.py +0 -0
  264. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/deliverable.py +0 -0
  265. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/dev.py +0 -0
  266. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/eval/__init__.py +0 -0
  267. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/examples/basic-chat/.acli/config.toml +0 -0
  268. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/examples/basic-chat/.acli/hooks.toml +0 -0
  269. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/examples/basic-chat/.acli/skills/explain-code.md +0 -0
  270. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/examples/basic-chat/.acli/skills/research-topic.md +0 -0
  271. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/examples/basic-chat/.acli/skills/translate.md +0 -0
  272. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/examples/basic-chat/.acli/skills/write-poem.md +0 -0
  273. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/examples/basic-chat/.acli/system-prompt.md +0 -0
  274. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/examples/dashscope-sdk-expert/.acli/config.toml +0 -0
  275. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/examples/dashscope-sdk-expert/.acli/hooks.toml +0 -0
  276. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/api-doc.md +0 -0
  277. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/diagnose.md +0 -0
  278. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/error-code.md +0 -0
  279. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/explain-code.md +0 -0
  280. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/retrieval.md +0 -0
  281. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/sdk-example.md +0 -0
  282. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/speech.md +0 -0
  283. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/examples/dashscope-sdk-expert/.acli/skills/translate.md +0 -0
  284. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/examples/dashscope-sdk-expert/README.md +0 -0
  285. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/extensions.py +0 -0
  286. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/hooks.py +0 -0
  287. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/mcp_server.py +0 -0
  288. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/mcp_stdio.py +0 -0
  289. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/memory/__init__.py +0 -0
  290. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/memory/manager.py +0 -0
  291. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/memory/plan.py +0 -0
  292. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/permission.py +0 -0
  293. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/platforms/__init__.py +0 -0
  294. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/platforms/bailian/__init__.py +0 -0
  295. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/platforms/bailian/cli.py +0 -0
  296. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/platforms/bailian/mcp.py +0 -0
  297. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/platforms/base.py +0 -0
  298. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/platforms/local/__init__.py +0 -0
  299. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/platforms/local/history.py +0 -0
  300. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/platforms/local/memory.py +0 -0
  301. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/prompt.py +0 -0
  302. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/providers/__init__.py +0 -0
  303. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/providers/adapter.py +0 -0
  304. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/providers/anthropic.py +0 -0
  305. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/providers/base.py +0 -0
  306. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/providers/openai.py +0 -0
  307. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/providers/profile.py +0 -0
  308. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/sandbox.py +0 -0
  309. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/scheduler.py +0 -0
  310. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/sdk.py +0 -0
  311. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/session.py +0 -0
  312. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/session_events.py +0 -0
  313. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/skills/manager.py +0 -0
  314. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/skills/package.py +0 -0
  315. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/skills/store.py +0 -0
  316. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/tools/__init__.py +0 -0
  317. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/tools/browser.py +0 -0
  318. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/tools/camera.py +0 -0
  319. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/tools/platform.py +0 -0
  320. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/tools/session.py +0 -0
  321. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/tools/skills.py +0 -0
  322. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/tools/web_search.py +0 -0
  323. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/ui/__init__.py +0 -0
  324. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/ui/camera.py +0 -0
  325. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/ui/embedded.py +0 -0
  326. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/ui/tts.py +0 -0
  327. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/ui/tui.py +0 -0
  328. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/ui/voice.py +0 -0
  329. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/utils/__init__.py +0 -0
  330. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/utils/clipboard.py +0 -0
  331. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/utils/exceptions.py +0 -0
  332. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/utils/ids.py +0 -0
  333. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/utils/images.py +0 -0
  334. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/utils/keywords.py +0 -0
  335. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/utils/messages.py +0 -0
  336. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/utils/sanitizer.py +0 -0
  337. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/utils/spinner.py +0 -0
  338. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/utils/template.py +0 -0
  339. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/utils/text.py +0 -0
  340. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/utils/toml.py +0 -0
  341. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/acli/utils/validation.py +0 -0
  342. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/agentstudio/constants.py +0 -0
  343. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/agentstudio/exceptions.py +0 -0
  344. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/agentstudio/resources/agents.py +0 -0
  345. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/agentstudio/resources/deployments.py +0 -0
  346. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/agentstudio/resources/environments.py +0 -0
  347. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/agentstudio/resources/files.py +0 -0
  348. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/agentstudio/resources/security.py +0 -0
  349. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/agentstudio/resources/session_events.py +0 -0
  350. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/agentstudio/resources/session_resources.py +0 -0
  351. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/agentstudio/resources/session_threads.py +0 -0
  352. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/agentstudio/resources/sessions.py +0 -0
  353. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/agentstudio/resources/skills.py +0 -0
  354. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/agentstudio/resources/vaults.py +0 -0
  355. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/agentstudio/resources/webhook_endpoints.py +0 -0
  356. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/agentstudio/streaming.py +0 -0
  357. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/agentstudio/transport.py +0 -0
  358. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/aigc/__init__.py +0 -0
  359. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/aigc/chat_completion.py +0 -0
  360. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/aigc/code_generation.py +0 -0
  361. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/aigc/conversation.py +0 -0
  362. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/aigc/generation.py +0 -0
  363. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/aigc/image_generation.py +0 -0
  364. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/aigc/image_synthesis.py +0 -0
  365. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/aigc/multimodal_conversation.py +0 -0
  366. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/aigc/video_synthesis.py +0 -0
  367. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/api_entities/__init__.py +0 -0
  368. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/api_entities/aio_session.py +0 -0
  369. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/api_entities/aiohttp_request.py +0 -0
  370. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/api_entities/api_request_data.py +0 -0
  371. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/api_entities/base_request.py +0 -0
  372. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/api_entities/chat_completion_types.py +0 -0
  373. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/api_entities/dashscope_response.py +0 -0
  374. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/api_entities/http_request.py +0 -0
  375. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/api_entities/websocket_request.py +0 -0
  376. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/app/__init__.py +0 -0
  377. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/app/application.py +0 -0
  378. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/app/application_response.py +0 -0
  379. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/assistants/__init__.py +0 -0
  380. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/assistants/assistant_types.py +0 -0
  381. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/assistants/assistants.py +0 -0
  382. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/assistants/files.py +0 -0
  383. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/audio/__init__.py +0 -0
  384. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/audio/asr/__init__.py +0 -0
  385. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/audio/asr/asr_phrase_manager.py +0 -0
  386. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/audio/asr/recognition.py +0 -0
  387. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/audio/asr/transcription.py +0 -0
  388. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/audio/asr/translation_recognizer.py +0 -0
  389. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/audio/asr/vocabulary.py +0 -0
  390. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/audio/http_tts/__init__.py +0 -0
  391. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/audio/http_tts/http_speech_synthesizer.py +0 -0
  392. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/audio/qwen_asr/__init__.py +0 -0
  393. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/audio/qwen_asr/qwen_transcription.py +0 -0
  394. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/audio/qwen_omni/__init__.py +0 -0
  395. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/audio/qwen_omni/omni_realtime.py +0 -0
  396. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/audio/qwen_tts/__init__.py +0 -0
  397. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/audio/qwen_tts/speech_synthesizer.py +0 -0
  398. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/audio/qwen_tts_realtime/__init__.py +0 -0
  399. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/audio/qwen_tts_realtime/qwen_tts_realtime.py +0 -0
  400. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/audio/tts/__init__.py +0 -0
  401. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/audio/tts/speech_synthesizer.py +0 -0
  402. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/audio/tts_v2/__init__.py +0 -0
  403. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/audio/tts_v2/enrollment.py +0 -0
  404. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/audio/tts_v2/speech_synthesizer.py +0 -0
  405. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/cli/__main__.py +0 -0
  406. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/cli/agentic_rl.py +0 -0
  407. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/cli/application.py +0 -0
  408. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/cli/auth.py +0 -0
  409. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/cli/code_generation.py +0 -0
  410. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/cli/common.py +0 -0
  411. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/cli/deployments.py +0 -0
  412. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/cli/embeddings.py +0 -0
  413. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/cli/files.py +0 -0
  414. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/cli/fine_tunes.py +0 -0
  415. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/cli/generation.py +0 -0
  416. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/cli/image_generation.py +0 -0
  417. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/cli/image_synthesis.py +0 -0
  418. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/cli/models.py +0 -0
  419. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/cli/multimodal_conversation.py +0 -0
  420. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/cli/multimodal_embedding.py +0 -0
  421. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/cli/oss.py +0 -0
  422. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/cli/rerank.py +0 -0
  423. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/cli/speech_synthesis.py +0 -0
  424. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/cli/tokenization.py +0 -0
  425. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/cli/transcription.py +0 -0
  426. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/cli/understanding.py +0 -0
  427. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/cli/video_synthesis.py +0 -0
  428. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/client/__init__.py +0 -0
  429. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/client/base_api.py +0 -0
  430. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/common/__init__.py +0 -0
  431. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/common/api_key.py +0 -0
  432. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/common/base_type.py +0 -0
  433. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/common/constants.py +0 -0
  434. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/common/env.py +0 -0
  435. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/common/error.py +0 -0
  436. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/common/logging.py +0 -0
  437. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/common/message_manager.py +0 -0
  438. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/embeddings/__init__.py +0 -0
  439. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/embeddings/batch_text_embedding.py +0 -0
  440. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/embeddings/batch_text_embedding_response.py +0 -0
  441. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/embeddings/multimodal_embedding.py +0 -0
  442. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/files.py +0 -0
  443. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/__init__.py +0 -0
  444. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/agentic_rl.py +0 -0
  445. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/customize_types.py +0 -0
  446. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/deployments.py +0 -0
  447. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/finetunes.py +0 -0
  448. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/common/__init__.py +0 -0
  449. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/common/errors.py +0 -0
  450. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/common/log.py +0 -0
  451. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/common/model.py +0 -0
  452. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/common/model_types.py +0 -0
  453. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/common/utils.py +0 -0
  454. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/__init__.py +0 -0
  455. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/data/__init__.py +0 -0
  456. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/demo/__init__.py +0 -0
  457. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/demo/group_reward_processor_demo.py +0 -0
  458. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/demo/reward_processor_demo.py +0 -0
  459. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/demo/rollout_processor_demo.py +0 -0
  460. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/func_decorator.py +0 -0
  461. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/func_manager.py +0 -0
  462. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/observability/__init__.py +0 -0
  463. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/observability/genai/__init__.py +0 -0
  464. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/observability/genai/_core.py +0 -0
  465. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/observability/genai/llm_dashscope.py +0 -0
  466. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/observability/genai/llm_openai.py +0 -0
  467. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/observability/genai/llm_span.py +0 -0
  468. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/observability/genai/messages.py +0 -0
  469. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/observability/genai/tools.py +0 -0
  470. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/parser/__init__.py +0 -0
  471. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/parser/base_parser.py +0 -0
  472. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/parser/group_reward_parser.py +0 -0
  473. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/parser/reward_parser.py +0 -0
  474. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/parser/rollout_parser.py +0 -0
  475. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/processor/__init__.py +0 -0
  476. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/processor/abstract_group_reward_processor.py +0 -0
  477. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/processor/abstract_processor.py +0 -0
  478. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/processor/abstract_reward_processor.py +0 -0
  479. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/processor/abstract_rollout_processor.py +0 -0
  480. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/server/__init__.py +0 -0
  481. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/finetune/reinforcement/component/server/server.py +0 -0
  482. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/io/__init__.py +0 -0
  483. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/io/input_output.py +0 -0
  484. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/model.py +0 -0
  485. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/models.py +0 -0
  486. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/multimodal/__init__.py +0 -0
  487. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/multimodal/dialog_state.py +0 -0
  488. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/multimodal/multimodal_constants.py +0 -0
  489. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/multimodal/multimodal_dialog.py +0 -0
  490. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/multimodal/multimodal_request_params.py +0 -0
  491. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/multimodal/tingwu/__init__.py +0 -0
  492. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/multimodal/tingwu/tingwu.py +0 -0
  493. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/multimodal/tingwu/tingwu_realtime.py +0 -0
  494. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/nlp/__init__.py +0 -0
  495. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/nlp/understanding.py +0 -0
  496. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/protocol/__init__.py +0 -0
  497. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/protocol/websocket.py +0 -0
  498. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/py.typed +0 -0
  499. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/rerank/__init__.py +0 -0
  500. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/resources/qwen.tiktoken +0 -0
  501. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/threads/__init__.py +0 -0
  502. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/threads/messages/__init__.py +0 -0
  503. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/threads/messages/files.py +0 -0
  504. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/threads/messages/messages.py +0 -0
  505. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/threads/runs/__init__.py +0 -0
  506. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/threads/runs/runs.py +0 -0
  507. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/threads/runs/steps.py +0 -0
  508. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/threads/thread_types.py +0 -0
  509. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/threads/threads.py +0 -0
  510. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/tokenizers/__init__.py +0 -0
  511. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/tokenizers/qwen_tokenizer.py +0 -0
  512. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/tokenizers/tokenization.py +0 -0
  513. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/tokenizers/tokenizer.py +0 -0
  514. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/tokenizers/tokenizer_base.py +0 -0
  515. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/utils/__init__.py +0 -0
  516. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/utils/message_utils.py +0 -0
  517. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope/utils/param_utils.py +0 -0
  518. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope.egg-info/dependency_links.txt +0 -0
  519. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope.egg-info/entry_points.txt +0 -0
  520. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope.egg-info/not-zip-safe +0 -0
  521. {dashscope-1.27.7 → dashscope-2.0.1}/dashscope.egg-info/top_level.txt +0 -0
  522. {dashscope-1.27.7 → dashscope-2.0.1}/setup.cfg +0 -0
@@ -4,4 +4,5 @@ include dashscope/__init__.pyi
4
4
  include NOTICE
5
5
  include LICENSE.certifi
6
6
  recursive-include dashscope/acli/examples *.md *.toml *.py
7
+ recursive-include examples *.md *.py
7
8
  include requirements.txt
@@ -0,0 +1,532 @@
1
+ Metadata-Version: 2.4
2
+ Name: dashscope
3
+ Version: 2.0.1
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: httpx>=0.27.0
34
+ Requires-Dist: httpx-sse>=0.4.0
35
+ Requires-Dist: typing_extensions>=4.16.0
36
+ Requires-Dist: tiktoken
37
+ Requires-Dist: pydantic>=2.0
38
+ Requires-Dist: tenacity
39
+ Requires-Dist: PyYAML>=6.0
40
+ Requires-Dist: fastapi>=0.100
41
+ Requires-Dist: uvicorn>=0.20
42
+ Requires-Dist: opentelemetry-sdk>=1.20
43
+ Provides-Extra: acli
44
+ Requires-Dist: prompt-toolkit>=3.0; extra == "acli"
45
+ Requires-Dist: textual<9,>=0.50; extra == "acli"
46
+ Requires-Dist: PyYAML>=6.0; extra == "acli"
47
+ Requires-Dist: tomli>=2.0; python_version < "3.11" and extra == "acli"
48
+ Provides-Extra: acli-anthropic
49
+ Requires-Dist: anthropic<2,>=0.40; extra == "acli-anthropic"
50
+ Provides-Extra: acli-openai
51
+ Requires-Dist: openai<4,>=1.30; extra == "acli-openai"
52
+ Provides-Extra: acli-voice
53
+ Requires-Dist: sounddevice>=0.4; extra == "acli-voice"
54
+ Requires-Dist: numpy>=1.20; extra == "acli-voice"
55
+ Provides-Extra: acli-camera
56
+ Requires-Dist: opencv-python-headless>=4.5; extra == "acli-camera"
57
+ Provides-Extra: acli-all
58
+ Requires-Dist: prompt-toolkit>=3.0; extra == "acli-all"
59
+ Requires-Dist: textual<9,>=0.50; extra == "acli-all"
60
+ Requires-Dist: PyYAML>=6.0; extra == "acli-all"
61
+ Requires-Dist: tomli>=2.0; python_version < "3.11" and extra == "acli-all"
62
+ Requires-Dist: anthropic<2,>=0.40; extra == "acli-all"
63
+ Requires-Dist: openai<4,>=1.30; extra == "acli-all"
64
+ Requires-Dist: sounddevice>=0.4; extra == "acli-all"
65
+ Requires-Dist: numpy>=1.20; extra == "acli-all"
66
+ Requires-Dist: opencv-python-headless>=4.5; extra == "acli-all"
67
+ Dynamic: author
68
+ Dynamic: author-email
69
+ Dynamic: classifier
70
+ Dynamic: description
71
+ Dynamic: description-content-type
72
+ Dynamic: home-page
73
+ Dynamic: license
74
+ Dynamic: license-file
75
+ Dynamic: platform
76
+ Dynamic: provides-extra
77
+ Dynamic: requires-dist
78
+ Dynamic: requires-python
79
+ Dynamic: summary
80
+
81
+ # DashScope Python SDK
82
+
83
+ > **English** | [中文](README_zh.md)
84
+
85
+ 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.
86
+
87
+ **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 1.x module-level API (`dashscope.Generation`, …) is unchanged and still fully supported, so 2.0 is purely additive.
88
+
89
+ ## What's new in 2.0
90
+
91
+ | | 1.x | 2.0 |
92
+ |---|---|---|
93
+ | Entry point | Module-level static classes: `Generation.call(...)` | A resource-style client: `client.chat.completions.create(...)` |
94
+ | One-liner | — | `dashscope.chat("qwen-plus", "Tell me a joke")` |
95
+ | Response | Raw dict-like; check `status_code == HTTPStatus.OK` | Typed object; read `resp.output_text`, `resp.usage.total_tokens` |
96
+ | Errors | Inspect `resp.code` / `resp.message` by hand | Typed `DashScopeError` exceptions raised by default *(evolving)* |
97
+ | Streaming | Generator of raw frames | `ChatStream` with `.text_stream`, `.reasoning_stream`, `.get_final_message()` |
98
+ | Protocols | DashScope native + a separate compatible-mode entry | One client speaks `native`, `openai`, or `anthropic` via `protocol=` |
99
+ | Async | Separate `Aio*` classes | `dashscope.AsyncClient()` mirrors the whole sync surface |
100
+ | Connections | A fresh session per call | One keep-alive pool per client, shared across resources |
101
+ | Config | Module globals (`dashscope.api_key`, `set_region`) | Layered: args → `dashscope.settings` → env → `~/.dashscope/config.toml` |
102
+
103
+ ## Installation
104
+
105
+ ```shell
106
+ pip install -U dashscope
107
+ ```
108
+
109
+ The base install covers SDK API calls, the `dashscope` CLI command, Agentic RL fine-tuning and the local tokenizer. Python 3.9+ is required. One optional feature group remains:
110
+
111
+ | Extra | Provides | Install |
112
+ |-------|----------|---------|
113
+ | `acli` | Interactive AI assistant (DashScope SDK Expert) | `pip install "dashscope[acli]"` |
114
+
115
+ To install from a source checkout:
116
+
117
+ ```shell
118
+ pip install -e .
119
+ ```
120
+
121
+ ## Quick start
122
+
123
+ Set your API key ([how to get one](https://help.aliyun.com/en/model-studio/get-api-key)):
124
+
125
+ ```shell
126
+ export DASHSCOPE_API_KEY="sk-xxx"
127
+ ```
128
+
129
+ **One line** — the fastest way to a completion:
130
+
131
+ ```python
132
+ import dashscope
133
+
134
+ completion = dashscope.chat("qwen-plus", "Tell me a joke")
135
+ print(completion.output_text)
136
+ ```
137
+
138
+ **Client** — the recommended form for anything real. One client, reused across calls:
139
+
140
+ ```python
141
+ import dashscope
142
+
143
+ client = dashscope.Client() # reads DASHSCOPE_API_KEY
144
+
145
+ resp = client.chat.completions.create(
146
+ model="qwen-plus",
147
+ messages=[
148
+ {"role": "system", "content": "You are a helpful assistant."},
149
+ {"role": "user", "content": "Who are you?"},
150
+ ],
151
+ )
152
+ print(resp.output_text)
153
+ print(resp.usage.total_tokens, "tokens |", resp.request_id)
154
+ ```
155
+
156
+ **Streaming** — `stream=True` returns a `ChatStream`:
157
+
158
+ ```python
159
+ stream = client.chat.completions.create(
160
+ model="qwen-plus",
161
+ messages=[{"role": "user", "content": "Write a haiku about the sea"}],
162
+ stream=True,
163
+ )
164
+ for text in stream.text_stream:
165
+ print(text, end="", flush=True)
166
+
167
+ # Or collapse the whole stream into one merged ChatCompletion (with usage):
168
+ # final = stream.get_final_message()
169
+ ```
170
+
171
+ **Async** — `AsyncClient` mirrors the sync surface:
172
+
173
+ ```python
174
+ import asyncio
175
+ import dashscope
176
+
177
+ async def main():
178
+ client = dashscope.AsyncClient()
179
+ resp = await client.chat.completions.create(
180
+ model="qwen-plus",
181
+ messages=[{"role": "user", "content": "Hello"}],
182
+ )
183
+ print(resp.output_text)
184
+ await client.aclose()
185
+
186
+ asyncio.run(main())
187
+ ```
188
+
189
+ ## Core concepts
190
+
191
+ ### The client
192
+
193
+ `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:
194
+
195
+ ```python
196
+ client = dashscope.Client(
197
+ api_key="sk-xxx", # default: DASHSCOPE_API_KEY
198
+ workspace="ws-xxx123", # default: DASHSCOPE_WORKSPACE
199
+ region="cn-beijing", # default: DASHSCOPE_REGION
200
+ protocol="native", # native | openai | anthropic
201
+ timeout=300.0,
202
+ max_retries=2,
203
+ )
204
+ ```
205
+
206
+ 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):
207
+
208
+ ```python
209
+ with dashscope.Client() as client:
210
+ client.chat.completions.create(model="qwen-plus", messages=["hi"])
211
+
212
+ low_latency = client.with_options(timeout=10.0, max_retries=0)
213
+ ```
214
+
215
+ Any call also accepts per-request `api_key=`, `workspace=`, and `timeout=` overrides.
216
+
217
+ ### Protocols
218
+
219
+ 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:
220
+
221
+ | `protocol` | Talks to | Use when |
222
+ |------------|----------|----------|
223
+ | `native` (default) | DashScope native API (`/api/v1`) | You want the full DashScope feature set |
224
+ | `openai` | OpenAI-compatible mode (`/compatible-mode/v1`) | You're porting OpenAI code — no `openai` package needed |
225
+ | `anthropic` | Anthropic-compatible mode (`/apps/anthropic`) | You're porting Anthropic Messages code |
226
+
227
+ ```python
228
+ client = dashscope.Client(protocol="openai")
229
+ resp = client.chat.completions.create(
230
+ model="qwen-plus",
231
+ messages=[{"role": "user", "content": "Hello"}],
232
+ )
233
+ ```
234
+
235
+ ### Typed responses
236
+
237
+ 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`:
238
+
239
+ ```python
240
+ resp = client.chat.completions.create(model="qwen-plus", messages=["hi"])
241
+
242
+ resp.output_text # choices[0].message.content
243
+ resp.choices[0].message.content # same, explicit
244
+ resp.choices[0].message.reasoning_content # thinking-model reasoning, if any
245
+ resp.choices[0].message.tool_calls # tool calls, if any
246
+ resp.usage.input_tokens # also .output_tokens / .total_tokens
247
+ resp.request_id
248
+ ```
249
+
250
+ All responses share a common envelope: `request_id`, `status_code`, `code`, `message`, `is_error`, and raw `headers`.
251
+
252
+ ### Streaming
253
+
254
+ `stream=True` returns a `ChatStream` (`AsyncChatStream` for `AsyncClient`) with typed helpers:
255
+
256
+ ```python
257
+ stream = client.chat.completions.create(model="qwen-plus", messages=["hi"], stream=True)
258
+
259
+ for text in stream.text_stream: # content deltas
260
+ ...
261
+ # stream.reasoning_stream # reasoning deltas (thinking models)
262
+ # stream.tool_call_stream # tool-call deltas
263
+ # stream.get_final_message() # merged ChatCompletion, incl. usage
264
+ ```
265
+
266
+ By default each frame is incremental. Pass `incremental_output=False` to receive cumulative snapshots instead (the SDK merges deltas for you).
267
+
268
+ > **Note:** the SDK does **not** auto-retry streaming requests. 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).
269
+
270
+ ### Errors
271
+
272
+ > **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.
273
+
274
+ Failures raise a typed `DashScopeError` by default (both non-2xx HTTP statuses and HTTP-200-with-a-business-error land here):
275
+
276
+ ```python
277
+ from dashscope.v2 import errors
278
+
279
+ try:
280
+ client.chat.completions.create(model="qwen-plus", messages=["hi"])
281
+ except errors.RateLimitError as exc:
282
+ print("throttled:", exc.code, exc.status_code, exc.request_id)
283
+ except errors.ContentFilterError as exc:
284
+ print("blocked by moderation:", exc.message)
285
+ except errors.DashScopeError as exc: # base class for all SDK errors
286
+ print("request failed:", exc.code, exc.message)
287
+ ```
288
+
289
+ The hierarchy includes `APIConnectionError` / `APITimeoutError` (network) and, under `APIStatusError`: `BadRequestError`, `AuthenticationError`, `PermissionDeniedError`, `NotFoundError`, `RequestTooLargeError`, `RateLimitError`, `InternalServerError`, `ServiceUnavailableError`, `GatewayTimeoutError`, and `ContentFilterError`.
290
+
291
+ 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`:
292
+
293
+ ```python
294
+ client = dashscope.Client(raise_on_error=False)
295
+ resp = client.chat.completions.create(model="qwen-plus", messages=["hi"])
296
+ if resp.is_error:
297
+ print(resp.code, resp.message)
298
+ ```
299
+
300
+ ## Authentication
301
+
302
+ 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):
303
+
304
+ 1. **Per client** — `dashscope.Client(api_key="sk-xxx")`
305
+ 2. **Global settings** — `dashscope.settings.api_key = "sk-xxx"` (applies to clients created afterwards)
306
+ 3. **Environment variable** — `export DASHSCOPE_API_KEY="sk-xxx"`
307
+ 4. **Config file** — `api_key` in `~/.dashscope/config.toml`
308
+ 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
309
+
310
+ Any call also accepts a per-request `api_key=` override.
311
+
312
+ > **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`.
313
+
314
+ ## Configuration
315
+
316
+ Configuration resolves in layers — **explicit arguments → `dashscope.settings` → environment variables → `~/.dashscope/config.toml`**. Set it once at startup, per client, or not at all.
317
+
318
+ **Global settings facade:**
319
+
320
+ ```python
321
+ import dashscope
322
+
323
+ dashscope.settings.api_key = "sk-xxx"
324
+ dashscope.settings.workspace = "ws-xxx123"
325
+ dashscope.settings.region = "ap-southeast-1"
326
+ dashscope.settings.protocol = "openai"
327
+ dashscope.settings.timeout = 60.0
328
+ dashscope.settings.max_retries = 3
329
+ dashscope.settings.log_level = "INFO"
330
+ ```
331
+
332
+ **Environment variables:**
333
+
334
+ | Variable | Sets | Default |
335
+ |----------|------|---------|
336
+ | `DASHSCOPE_API_KEY` | API key | — |
337
+ | `DASHSCOPE_WORKSPACE` | Workspace ID (endpoint subdomain) | — |
338
+ | `DASHSCOPE_REGION` | Region | `cn-beijing` |
339
+ | `DASHSCOPE_PROTOCOL` | `native` / `openai` / `anthropic` | `native` |
340
+ | `DASHSCOPE_BASE_URL` | Override the endpoint entirely (escape hatch) | — |
341
+ | `DASHSCOPE_TIMEOUT` | Request timeout (seconds) | `300` |
342
+ | `DASHSCOPE_MAX_RETRIES` | Automatic retries | `2` |
343
+ | `DASHSCOPE_LOG` | Log level | `WARNING` |
344
+ | `DASHSCOPE_CONFIG` | Path to `config.toml` | `~/.dashscope/config.toml` |
345
+
346
+ **Config file** (`~/.dashscope/config.toml`):
347
+
348
+ ```toml
349
+ api_key = "sk-xxx"
350
+ workspace = "ws-xxx123"
351
+ region = "ap-southeast-1"
352
+ protocol = "native"
353
+ timeout = 300.0
354
+ max_retries = 2
355
+ ```
356
+
357
+ ### Regions and endpoints
358
+
359
+ 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`):
360
+
361
+ ```python
362
+ client = dashscope.Client(region="ap-southeast-1", workspace="ws-xxx123")
363
+ # -> https://ws-xxx123.ap-southeast-1.maas.aliyuncs.com/api/v1
364
+ ```
365
+
366
+ | Region | Location |
367
+ |--------|----------|
368
+ | `cn-beijing` | China (Beijing) — default |
369
+ | `cn-hongkong` | China (Hong Kong) |
370
+ | `ap-southeast-1` | Singapore |
371
+ | `ap-northeast-1` | Japan (Tokyo) |
372
+ | `eu-central-1` | Germany (Frankfurt) |
373
+ | `us-east-1` | US (Virginia) |
374
+
375
+ Notes:
376
+
377
+ - **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.
378
+ - WebSocket-based realtime APIs (realtime speech, multimodal dialog) are served in `cn-beijing` and `ap-southeast-1`.
379
+ - Batch inference, fine-tuning and application development are currently available in `cn-beijing` and `ap-southeast-1`.
380
+ - `base_url=` (or `DASHSCOPE_BASE_URL`) overrides everything — the escape hatch for custom/private gateways; it does not require a workspace.
381
+ - The 1.x `dashscope.set_region(region, workspace_id)` global still works for the 1.x module-level API.
382
+
383
+ ## Capabilities
384
+
385
+ Every capability is a resource on the client. Sync and async clients expose the same surface (async methods are `await`ed).
386
+
387
+ | Capability | 2.0 resource | Example |
388
+ |------------|--------------|---------|
389
+ | Text chat / generation | `client.chat.completions.create(...)` | [`text_generation/chat.py`](examples/01_atomic_capabilities/text_generation/chat.py) |
390
+ | Multi-modal chat (vision, video) | `client.multimodal.chat.create(...)` | [`multimodal_vision/multimodal_chat.py`](examples/01_atomic_capabilities/multimodal_vision/multimodal_chat.py) |
391
+ | Text embedding | `client.embeddings.create(...)` (+ `.jobs` for batch) | [`embeddings/embeddings.py`](examples/01_atomic_capabilities/embeddings/embeddings.py) |
392
+ | Multi-modal embedding | `client.multimodal.embeddings.create(...)` | [`embeddings/`](examples/01_atomic_capabilities/embeddings/) |
393
+ | Rerank | `client.rerank.create(...)` | [`rerank/rerank.py`](examples/01_atomic_capabilities/rerank/rerank.py) |
394
+ | Decision (System One) | `client.decision.create(...)` | [`decision/decision.py`](examples/01_atomic_capabilities/decision/decision.py) |
395
+ | Token counting | `client.tokenization.count(...)` | [`text_generation/tokenization.py`](examples/01_atomic_capabilities/text_generation/tokenization.py) |
396
+ | Image generation | `client.images.generate(...)` (+ `.jobs`) | [`image_video_synthesis/images.py`](examples/01_atomic_capabilities/image_video_synthesis/images.py) |
397
+ | Video generation | `client.videos.generate(...)` (+ `.jobs`) | [`image_video_synthesis/videos.py`](examples/01_atomic_capabilities/image_video_synthesis/videos.py) |
398
+ | Speech: ASR / TTS / realtime *(preview)* | `client.audio.asr` · `client.audio.tts` · `client.audio.realtime` | [`audio/`](examples/01_atomic_capabilities/audio/) |
399
+ | Meeting & audio understanding (TingWu) | `client.tingwu.call(...)` / `.realtime(...)` | [`audio/tingwu.py`](examples/01_atomic_capabilities/audio/tingwu.py) |
400
+ | Files | `client.files.upload/list/get/delete(...)` | [`files/files.py`](examples/01_atomic_capabilities/files/files.py) |
401
+ | Models | `client.models.list/get(...)` | [`models/models.py`](examples/01_atomic_capabilities/models/models.py) |
402
+ | 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) |
403
+ | Model deployments | `client.deployments.create/scale/list/delete(...)` | [`fine_tuning/`](examples/01_atomic_capabilities/fine_tuning/) |
404
+ | Agentic RL | `client.rl` (`.jobs`, `register_functions`, `upload_data`) | [`fine_tuning/reinforcement_learning.py`](examples/01_atomic_capabilities/fine_tuning/reinforcement_learning.py) |
405
+ | Model Studio applications | `client.apps.completions.create(...)` | [`applications/apps.py`](examples/01_atomic_capabilities/applications/apps.py) |
406
+ | AgentStudio (agents, sessions, memory) | `client.agentstudio` | [`03_agent_recipes/agentstudio.py`](examples/03_agent_recipes/agentstudio.py) |
407
+
408
+ A few common shapes:
409
+
410
+ ```python
411
+ # Embeddings
412
+ resp = client.embeddings.create(model="text-embedding-v4", input=["hello", "world"], dimension=1024)
413
+ resp.embeddings[0].embedding
414
+
415
+ # Multi-modal chat (image understanding)
416
+ resp = client.multimodal.chat.create(
417
+ model="qwen3-vl-plus",
418
+ messages=[{"role": "user", "content": [{"image": "https://.../cat.png"}, {"text": "What is this?"}]}],
419
+ )
420
+ resp.output_text
421
+
422
+ # Image generation (submit + wait); use client.images.jobs for manual control
423
+ job = client.images.generate(model="wanx2.1-t2i-turbo", prompt="a cozy flower shop", size="1024*1024")
424
+ if job.succeeded:
425
+ print(job.image_urls)
426
+
427
+ # A Model Studio application
428
+ resp = client.apps.completions.create(app_id="YOUR_APP_ID", prompt="How do I make stew?")
429
+ resp.text
430
+ ```
431
+
432
+ > **Audio is a preview.** The 2.0 `client.audio` surface is not final and may change; accessing it emits a `FutureWarning`.
433
+
434
+ ### Realtime over one WebSocket
435
+
436
+ For latency-sensitive realtime audio, open a shared duplex socket and run multiple sessions on it instead of handshaking per task:
437
+
438
+ ```python
439
+ connection = client.ws_connection()
440
+ session = client.audio.asr.recognize(model="fun-asr-realtime", connection=connection)
441
+ # ... drive the session; the caller owns the connection ...
442
+ connection.close()
443
+ ```
444
+
445
+ ## Supported models
446
+
447
+ | Category | Example models | 2.0 resource |
448
+ |----------|----------------|--------------|
449
+ | Text generation | qwen-max, qwen-plus, qwen-flash | `client.chat` |
450
+ | Multi-modal understanding | qwen3-vl-plus, qwen-omni | `client.multimodal.chat` |
451
+ | Text embedding | text-embedding-v4, text-embedding-v3 | `client.embeddings` |
452
+ | Multi-modal embedding | tongyi-embedding-vision-plus | `client.multimodal.embeddings` |
453
+ | Rerank | gte-rerank-v2, qwen3-rerank | `client.rerank` |
454
+ | Image generation | wanx2.1-t2i-turbo, wan-image | `client.images` |
455
+ | Video generation | wanx2.1-t2v, wan-i2v | `client.videos` |
456
+ | Speech synthesis (TTS) | cosyvoice-v1, qwen-tts | `client.audio.tts` |
457
+ | Speech recognition (ASR) | fun-asr-realtime, paraformer-v1 | `client.audio.asr` |
458
+ | Omni (realtime) | qwen-omni-realtime | `client.audio.realtime` |
459
+
460
+ For the latest model list, visit the [Model Studio model plaza](https://bailian.console.aliyun.com/).
461
+
462
+ ## AI Assistant: DashScope SDK Expert
463
+
464
+ 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.
465
+
466
+ - 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.
467
+ - 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.
468
+ - Install with the `acli` extra: `pip install "dashscope[acli]"`.
469
+ - Full walkthrough: [DashScope SDK Expert guide](https://help.aliyun.com/en/model-studio/dashscope-sdk-expert).
470
+
471
+ ## Shell completion
472
+
473
+ Run the command for your shell once, then restart the shell (or re-source your config):
474
+
475
+ | Shell | Install command |
476
+ |-------|-----------------|
477
+ | **bash** | `dashscope --install-completion bash` |
478
+ | **zsh** | `dashscope --install-completion zsh` |
479
+ | **fish** | `dashscope --install-completion fish` |
480
+
481
+ Preview the script without installing:
482
+
483
+ ```shell
484
+ dashscope --show-completion bash
485
+ ```
486
+
487
+ ## Logging
488
+
489
+ Set the level via settings or the environment:
490
+
491
+ ```python
492
+ dashscope.settings.log_level = "INFO"
493
+ ```
494
+
495
+ ```shell
496
+ export DASHSCOPE_LOG="INFO"
497
+ ```
498
+
499
+ ## Examples
500
+
501
+ The [`examples/`](examples/) directory is a production best-practices collection built on the 2.0 client, organized as an advancement path:
502
+
503
+ ```
504
+ examples/
505
+ ├── 01_atomic_capabilities/ Minimal runnable quickref per capability
506
+ ├── 02_advanced_engineering/ Mock debugging, semantic cache, circuit breaker + multi-region DR
507
+ ├── 03_agent_recipes/ Tool-call loop, RAG, MCP server, AgentStudio
508
+ ├── 04_real_world_scenarios/ End-to-end production harnesses (RAG, realtime meetings, customer service)
509
+ └── legacy_1x/ 1.x module-level API examples, for reference
510
+ ```
511
+
512
+ See [`examples/README.md`](examples/README.md). Several flagship cases run fully offline (mock transports) with no API key.
513
+
514
+ ## Migrating from 1.x
515
+
516
+ 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:
517
+
518
+ | 1.x | 2.0 |
519
+ |-----|-----|
520
+ | `Generation.call(model=..., messages=..., result_format="message")` | `client.chat.completions.create(model=..., messages=...)` |
521
+ | `resp.status_code == HTTPStatus.OK` then `resp.output.choices[0].message.content` | `resp.output_text` (errors raise by default) |
522
+ | `MultiModalConversation.call(...)` | `client.multimodal.chat.create(...)` |
523
+ | `TextEmbedding.call(...)` | `client.embeddings.create(...)` |
524
+ | `TextReRank.call(...)` | `client.rerank.create(...)` |
525
+ | `ImageSynthesis.call(...)` / `.async_call(...)` | `client.images.generate(...)` / `client.images.jobs` |
526
+ | `dashscope.api_key = "sk-xxx"` | `dashscope.Client(api_key=...)` or `dashscope.settings.api_key = ...` |
527
+ | `dashscope.set_region(region, workspace_id)` | `dashscope.Client(region=..., workspace=...)` |
528
+ | OpenAI-compatible via `dashscope.aigc.chat_completion.Completions` | `dashscope.Client(protocol="openai")` |
529
+
530
+ ## License
531
+
532
+ This project is licensed under the Apache License (Version 2.0).