Skip to content

feat(v2): land the dashscope 2.0 SDK stack alongside 1.x - #211

Merged
luk384090-cloud merged 10 commits into
mainfrom
dev/v2
Oct 20, 2026
Merged

luk384090-cloud merged 10 commits into
mainfrom
dev/v2

Conversation

@lzsweb

@lzsweb lzsweb commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add dashscope/v2 (client, protocols, resources, transport, types) and tests/v2; share one process-wide SDK session id across the 1.x and 2.0 stacks
  • acli and its tests kept at the online version; examples/ tree added, samples/ removed
  • Forward base_address/workspace through oss_utils so v2 clients fetch OSS certificates from their own endpoint

Test plan

  • Full UT (tests/unit + tests/v2): 2197 passed / 10 skipped
  • pre-commit --all-files: all hooks passed

zhansheng.lzs and others added 10 commits October 16, 2026 17:30
- add dashscope/v2 (client, protocols, resources, transport, types)
  and tests/v2; share one process-wide SDK session id via
  common/_sdk_session.py across the 1.x and 2.0 stacks
- forward base_address/workspace through oss_utils certificate fetch
  so v2 clients fetch OSS upload certificates from their own endpoint
- keep dashscope/acli and its unit tests at the online version
- migrate RL data models to pydantic ConfigDict and restore the lazy
  Assistants imports so a plain "import dashscope" stays
  deprecation-warning free
recipes, real-world scenarios) referenced by the READMEs
examples/legacy_1x/set_region_example.py
The Assistants family resolves through the lazy PEP 562 __getattr__
in dashscope/__init__.py, which pylint's CI environment does not
count as importable names (E0611). Use the inline disable, matching
the existing convention in tests/unit/test_threads.py.
Resolve the samples/test_agentstudio.py modify/delete conflict by
keeping it deleted; its memory-stores flow is ported into
examples/legacy_1x/agentstudio.py.
…ckref

AgentStudio and agentic RL are shared by the 1.x/2.0 generations, so
they do not belong under legacy_1x. agentstudio examples now use the
client.agentstudio entry; reinforcement_learning.py covers client.rl.
client.audio now mounts lazily and emits a one-time FutureWarning on
first access; Audio/AsyncAudio docstrings and the examples READMEs
carry the same preview note.
….0.1) (#214)

* feat(v2): align audio with current speech models and protocols

Merge the audio protocol updates and their ride-along fixes:

- rework audio resources (asr/tts/realtime/voices/voice_design/
  phrases/customization) for the current qwen-audio and cosyvoice
  model families; drop audio.translation, superseded by realtime
  sessions (realtime_translation)
- harden the shared ws transport for multi-task connections:
  cross-task event guard, reader routing/error propagation and
  lifecycle cleanup; submit explicitly empty job parameters
- agentstudio proxy rewrite: original error-code fidelity, wider
  stream-error translation, stale-cache and iterator-leak fixes
- errors/transport: multi-frame SSE error parsing, stream close on
  error, SDK auth header precedence, tool_choice=None passthrough
- examples: rename 01_atomic_capabilities/audio_speech to audio and
  merge in the speech sample suite (12 CLIs plus direct_call
  variants); drop the superseded audio_asr/audio_tts snippets
- unmark the 2.0 audio preview: the audio API is final

* chore(version): update version to 2.0.1

* fix(v2): placate full-tree mypy/pylint gate runs

The pre-commit CI job runs hooks over all files; wider inference
context than changed-file runs surfaces three findings:

- _agentstudio: restore the _STATUS_BY_CLASS Dict[type, int]
  annotation so __mro__ indexing type-checks
- test_audio_management: pinpoint-disable unsubscriptable-object on
  the mocked Optional[Dict] preview_audio subscript
- test_chat: pinpoint-disable not-an-iterable where pylint cannot
  resolve the stream=True overload

* ci(workflows): run unit tests on pull requests targeting dev/v2

- the Unit Tests workflow only triggered on pull requests to main, so
  PRs into dev/v2 (the v2 development line) got no CI test coverage
- add dev/v2 to the pull_request branch filter; the push trigger and
  the 3.9/3.12/3.13/3.14 matrix stay unchanged

* Revert "ci(workflows): run unit tests on pull requests targeting dev/v2"

This reverts commit dddffaa.

* fix(acli): poll instead of fixed sleeps in usage-flusher timing tests

- the fixed 0.3s sleep left the duration assertion only 0.1s of slack;
  a shared CI runner starved the daemon flusher thread for ~0.17s and
  the 3.14 UT leg failed (0.13 > first + 0.2)
- add _await_usage(): poll the usage file every 0.05s with a 5s
  deadline and use it in all three sleep-then-assert tests; the
  behavior contracts they pin are unchanged

---------

Co-authored-by: zhansheng.lzs <zhansheng.lzs@alibaba-inc.com>
- re-apply cbed9ae's preview marking, which the 2.0.1 audio alignment
  (#214) dropped: client.audio mounts lazily and emits a one-time
  FutureWarning on first access, Audio/AsyncAudio docstrings carry the
  preview note, and the examples READMEs flag the audio row
- the audio surface is still iterating, so the warning stays until it
  stabilizes
…for version 2.0

- 将SDK描述更新为官方客户端,涵盖更多功能如微调、Agentic RL、应用调用等
- 添加版本2.0新特性的详细对比表格,展示1.x到2.0的变化
- 更新安装命令为 pip install -U dashscope 并要求Python 3.9+
- 添加快速开始示例,包括一行调用、客户端使用、流式处理和异步操作
- 详细介绍核心概念如客户端、协议、类型化响应、流式处理和错误处理
- 更新认证和配置部分,说明分层配置机制和区域端点设置
- 添加能力矩阵和实时WebSocket连接说明
- 更新AI助手介绍和Shell补全说明
- 添加示例目录结构和迁移指南
- 完善中英文文档的同步更新
@luk384090-cloud
luk384090-cloud merged commit b9fbd75 into main Oct 20, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants