Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
f823b42
perf(tokenizers): exclude qwen.tiktoken from wheel, download on demand
Nov 16, 2026
33e6ed9
fix(audio): detach socket inside the error-processing lock hold
Nov 16, 2026
94a32ee
build(ci): add multi-platform CLI binary build workflow
Nov 16, 2026
65b41f0
docs(mkdocs): add MkDocs documentation site configuration and integra…
Nov 17, 2026
895ab7d
fix(pre-commit): exclude docs folder from stylelint hook
Nov 17, 2026
fe029d4
fix(docs): replace SVG logo with PNG format
Nov 17, 2026
0559e46
fix(docs): clarify mock billing and sync-only audio APIs
Nov 17, 2026
3ef9176
docs(mkdocs): improve sidebar and toc behavior for API reference pages
Nov 17, 2026
412e7be
docs(mkdocs): update navigation and symbol type display settings
Nov 17, 2026
474db5c
docs(cli): add Command Line Interface 2.0 section in English and Chinese
Nov 18, 2026
0b3ab71
chore(version): bump version to 2.1.1
Nov 18, 2026
127d7d6
docs(mkdocs): improve theme and 404 handling for multi-language support
Nov 18, 2026
42f557f
refactor(tokenizer): remove bundled vocab and enable download on firs…
Nov 18, 2026
c10326f
docs(cli): add SDK Expert (AgenticX) interactive AI assistant
Nov 18, 2026
5454203
docs(core): remove "2.0" version references in documentation
Nov 19, 2026
db4be4e
docs(en): update documentation with new features and clarifications
Nov 19, 2026
66658ad
feat(cli): rename acli extra to expert, keep acli* as compatible aliases
Nov 19, 2026
d22b9fa
docs: pin mkdocstrings, translate AgentStudio nav, note recipe image …
Nov 19, 2026
1354d56
chore(release): update release template with cleaned-up sections
Nov 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 7 additions & 36 deletions .github/release-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,52 +35,27 @@ invisible in the rendered Release page):

### 🚀 Highlights

- Qwen Live realtime audio sessions built on a shared realtime transport.
- New `dashscope.devkit`: offline self-diagnosis for failed calls plus static/record/replay HTTP mocking.
- Automated release pipeline — pushing a `v*` tag now builds, publishes to PyPI, and drafts the GitHub Release.
-

### ✨ Features

- audio: add Qwen Live sessions on the shared realtime transport (#231).
- audio: accept audio sources for voice enrollment.
- agentstudio: session mount fields for Bailian memory and OSS.
- devkit: add offline self-diagnosis for failed calls.
- devkit: add static/record/replay dev mock at the HTTP transport.
- transport: introduce `APIResponse` and a `raw` parameter for raw responses.
- transport: support per-request options across all resources.
- pagination: introduce a generic pagination base class and refactor resource list interfaces.
- parse: add fault-tolerant response model parsing and strict validation config.
- core: add client request ID and response validation exception.
- v2: extend typed parsing, per-request options, and pagination fixes to all resources.
- Enhance API response handling and resource methods.
-

### ♻️ Refactoring

- cli: migrate the agent runtime to `dashscope-agenticx` (#230).
- server: extract client disconnect response logic.
-

### 🐛 Bug Fixes

- tts: prevent `KeyError` for non-timestamp messages in speech parts.
- audio: preserve graceful Live and Realtime shutdown.
- reinforcement: preserve FaaS business errors and request context.
- reinforcement: address agentic RL review findings.
- reinforcement: allow local wheel paths in pip requirement tokens.
- core: unify API key resolution and improve error handling.
- v2: support more image models and input forms, including wan2.7 image responses.
- logging: correlate SDK 2.0 response errors with request IDs.
-

### 📚 Documentation

- None
-

### 🔧 CI & Chore

- release: add tag-triggered PyPI publishing workflow (#234).
- version: bump to 2.1.0.
- ci: pin Python 3.9 / unit-test runners to ubuntu-24.04.
- ci: run legacy unit tests on pushes and pull requests again.
- test: stabilize RL CLI help checks, align job list output, and move layer decoupling checks to the current suite.
-

### ⚠️ Breaking Changes

Expand All @@ -101,11 +76,7 @@ Thanks to all the contributors who made this release possible:
<!-- List @handles here. On the draft page, the "Generate release notes"
button in the top-right can auto-populate New Contributors. -->

- @zhansheng.lzs
- @luk384090-cloud
- @songguocola
- @foleydang
- @lzsweb
-

### 📝 Full Changelog

Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Docs

# FastAPI-style docs pipeline: every PR and main push builds the MkDocs
# Material site to validate it; pushes to main additionally deploy the HTML
# to GitHub Pages. Docs track main (latest), independent of the tag-driven
# release.yml flow.
on:
push:
branches: [main]
paths:
- 'docs/**'
- 'dashscope/**'
- 'mkdocs.yml'
- 'requirements-doc.txt'
- '.github/workflows/docs.yml'
pull_request:
paths:
- 'docs/**'
- 'dashscope/**'
- 'mkdocs.yml'
- 'requirements-doc.txt'
- '.github/workflows/docs.yml'
workflow_dispatch:

permissions:
contents: read

concurrency:
group: pages-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
# mkdocstrings imports the real package, so install it alongside the
# doc toolchain (httpx/pydantic etc. come in as runtime dependencies).
- run: python -m pip install -r requirements-doc.txt .
- name: Build HTML
run: mkdocs build --strict
- name: Upload site artifact
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v3
with:
path: site

deploy:
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
91 changes: 83 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,85 @@ jobs:
with:
python-version: '3.13'
- run: python -m pip install build twine
- run: python -m build
# dashscope is pure Python, so `python -m build` emits ONE universal
# py3-none-any wheel plus the sdist. pip installs that single wheel on
# every platform (Linux, Windows, macOS, iOS, Android, ...); native
# multi-platform distribution of the CLI is the `build` job below.
- run: python -m build --outdir dist
- run: twine check dist/*
- run: sha256sum dist/* > dist/SHA256SUMS-python
- uses: actions/upload-artifact@v4
with:
name: python-distribution
path: dist/*

build:
needs: [validate]
name: Build CLI binary (${{ matrix.platform }})
# Standalone `dashscope` CLI executables, one per desktop platform, built
# natively on each runner (no cross-compilation). Each OS builds its own
# arch: macos-latest is Apple Silicon, macos-15-intel is x86_64.
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
arch: arm64
platform: macos-arm64
executable: dashscope
- os: macos-15-intel
arch: x86_64
platform: macos-x86_64
executable: dashscope
- os: ubuntu-latest
arch: x86_64
platform: linux-x86_64
executable: dashscope
- os: windows-latest
arch: x86_64
platform: windows-x86_64
executable: dashscope.exe
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
# Base CLI scope: the package plus PyInstaller only. The optional
# expert/voice/camera extras (incl. the AgenticX agent) are intentionally
# NOT bundled, so the bare-`dashscope` agent path is unavailable in the
# binary by design; the v2 command tree is what ships.
- run: python -m pip install . "pyinstaller>=6.0"
- name: Build binary
run: |
pyinstaller \
--onefile \
--name ${{ matrix.executable }} \
--collect-all dashscope \
--collect-submodules dashscope.cli.commands \
--clean \
dashscope/cli/__main__.py
shell: bash
# `dashscope version` is the network-free v2 subcommand. There is no
# --version flag, and a bare `dashscope` would route to the (unbundled)
# agent, so the smoke test names the `version` command explicitly.
- name: Smoke test binary
run: ./dist/${{ matrix.executable }} version
shell: bash
- name: Package release asset
run: |
mkdir -p package/dashscope
cp "dist/${{ matrix.executable }}" package/dashscope/
tar -czf "dist/dashscope-cli-${{ matrix.platform }}.tar.gz" \
-C package dashscope
python -c 'import hashlib; from pathlib import Path; asset = Path("dist/dashscope-cli-${{ matrix.platform }}.tar.gz"); print(hashlib.sha256(asset.read_bytes()).hexdigest(), asset.name)' > "dist/SHA256SUMS-${{ matrix.platform }}"
shell: bash
- uses: actions/upload-artifact@v4
with:
name: dashscope-cli-${{ matrix.platform }}
path: |
dist/*.whl
dist/*.tar.gz
dist/dashscope-cli-${{ matrix.platform }}.tar.gz
dist/SHA256SUMS-${{ matrix.platform }}

pypi:
needs: [package]
Expand All @@ -64,11 +135,14 @@ jobs:
with:
name: python-distribution
path: dist/
# PyPI accepts only the wheel + sdist; drop the checksum sidecar.
- name: Keep only Python distributions
run: rm dist/SHA256SUMS-python
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

release:
needs: [package]
needs: [build, package]
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -77,10 +151,11 @@ jobs:
with:
fetch-depth: 0

# Collect every artifact: the Python distribution (wheel + sdist +
# checksums) and all four CLI binary tarballs, each under artifacts/<name>/.
- uses: actions/download-artifact@v4
with:
name: python-distribution
path: dist/
path: artifacts/

- name: Render release notes
env:
Expand Down Expand Up @@ -123,6 +198,6 @@ jobs:
uses: softprops/action-gh-release@v2
with:
body_path: release-body.md
files: dist/*
files: artifacts/**/*
draft: true
prerelease: ${{ steps.prerelease.outputs.flag }}
prerelease: ${{ steps.prerelease.outputs.flag }}
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ __pycache__/

# C extensions
*.so
*.pyd

# Distribution / packaging
.Python
Expand Down Expand Up @@ -66,9 +67,6 @@ instance/
# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/
Expand Down
7 changes: 6 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ repos:
- id: sort-simple-yaml
exclude: ^tests/legacy_1x/legacy/
- id: check-yaml
# mkdocs.yml uses Material's !!python/name emoji tags; --unsafe
# accepts custom tags while still validating YAML syntax.
args: [--unsafe]
exclude: |
(?x)^(
meta.yaml
Expand Down Expand Up @@ -206,7 +209,9 @@ repos:
hooks:
- id: stylelint
files: \.(css)$
exclude: '(.*css_third_party.*|^tests/legacy_1x/legacy/)'
# docs/ ships its own Material stylesheet without a stylelint config,
# matching the ^docs exemption already used by mypy and pylint.
exclude: '(.*css_third_party.*|^tests/legacy_1x/legacy/|^docs/)'
args: [ '--fix' ]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: 'v3.0.0'
Expand Down
Binary file added .search-shots/dark-chat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .search-shots/light-chat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .search-shots/light-empty.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .search-shots/zh-yuyin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
include dashscope/legacy_1x/tokenizers/qwen.tiktoken
include dashscope/py.typed
include dashscope/__init__.pyi
include NOTICE
Expand Down
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

> **English** | [中文](README_zh.md)

**Documentation**: [dashscope.github.io/dashscope-sdk-python](https://dashscope.github.io/dashscope-sdk-python/) — [中文文档](https://dashscope.github.io/dashscope-sdk-python/zh/)

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.

**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.
Expand Down Expand Up @@ -30,12 +32,14 @@ The base install covers SDK API calls, the `dashscope` CLI command, Agentic RL f

| Extra | Provides | Install |
|-------|----------|---------|
| `acli` | Interactive AI assistant (DashScope SDK Expert) | `pip install "dashscope[acli]"` |
| `acli-openai` | Run the assistant on an OpenAI-compatible model provider | `pip install "dashscope[acli-openai]"` |
| `acli-anthropic` | Run the assistant on an Anthropic model provider | `pip install "dashscope[acli-anthropic]"` |
| `acli-voice` | Voice input and spoken replies in the assistant | `pip install "dashscope[acli-voice]"` |
| `acli-camera` | Camera capture for image input in the assistant | `pip install "dashscope[acli-camera]"` |
| `acli-all` | All of the above (includes `acli`) | `pip install "dashscope[acli-all]"` |
| `expert` | Interactive AI assistant (DashScope SDK Expert) | `pip install "dashscope[expert]"` |
| `expert-openai` | Run the assistant on an OpenAI-compatible model provider | `pip install "dashscope[expert-openai]"` |
| `expert-anthropic` | Run the assistant on an Anthropic model provider | `pip install "dashscope[expert-anthropic]"` |
| `expert-voice` | Voice input and spoken replies in the assistant | `pip install "dashscope[expert-voice]"` |
| `expert-camera` | Camera capture for image input in the assistant | `pip install "dashscope[expert-camera]"` |
| `expert-all` | All of the above (includes `expert`) | `pip install "dashscope[expert-all]"` |

The original `acli*` extra names remain as backward-compatible aliases with identical dependencies.

To install from a source checkout:

Expand Down Expand Up @@ -515,7 +519,7 @@ The SDK integrates an interactive AI assistant, **DashScope SDK Expert**, powere

- Run `dashscope` with no arguments to start the assistant. On first run it offers to download the Expert profile and per-domain skills into `./.agenticx/`; the same profile can be installed later with `agenticx expert download dashscope-sdk-expert`.
- 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.
- With Python 3.10+, install 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).
- With Python 3.10+, install the `expert` extra: `pip install "dashscope[expert]"`. Add `expert-voice` / `expert-camera` for voice and camera input, or `expert-all` for everything — see the [extras table](#installation).
- Full walkthrough: [DashScope SDK Expert guide](https://help.aliyun.com/en/model-studio/dashscope-sdk-expert).

## Command line
Expand Down
18 changes: 11 additions & 7 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

> [English](README.md) | **中文**

**文档站点**:[dashscope.github.io/dashscope-sdk-python](https://dashscope.github.io/dashscope-sdk-python/zh/) —— [English docs](https://dashscope.github.io/dashscope-sdk-python/)

DashScope Python SDK 是[阿里云百炼(Model Studio)](https://help.aliyun.com/zh/model-studio/)的官方客户端,覆盖文本生成、多模态理解、向量(Embedding)、重排(Rerank)、图像/视频生成、语音合成与识别、模型调优、Agentic RL、应用调用等能力。

**2.0 版本**引入了资源风格的客户端 —— `dashscope.Client()`,其易用性对标 OpenAI SDK:一个客户端持有共享连接池,每项能力都以类型化资源的形式挂载其上(`client.chat`、`client.images`、`client.audio`……),响应是类型化对象而非裸字典,失败默认抛出异常。1.x 的完整公开接口仍保留在历史导入路径上,由 `dashscope.legacy_1x` 下的 Facade 实现;AgentStudio 与 Agentic RL 与 2.0 共享同一套业务核心,但各自的公开返回类型与错误契约保持独立。
Expand Down Expand Up @@ -30,12 +32,14 @@ pip install -U dashscope

| Extra | 提供的能力 | 安装命令 |
|-------|----------|---------|
| `acli` | 交互式 AI 助手(DashScope SDK Expert) | `pip install "dashscope[acli]"` |
| `acli-openai` | 让助手使用 OpenAI 兼容的模型服务方 | `pip install "dashscope[acli-openai]"` |
| `acli-anthropic` | 让助手使用 Anthropic 模型服务方 | `pip install "dashscope[acli-anthropic]"` |
| `acli-voice` | 助手的语音输入与语音播报 | `pip install "dashscope[acli-voice]"` |
| `acli-camera` | 助手的摄像头采集图片输入 | `pip install "dashscope[acli-camera]"` |
| `acli-all` | 以上全部(含 `acli`) | `pip install "dashscope[acli-all]"` |
| `expert` | 交互式 AI 助手(DashScope SDK Expert) | `pip install "dashscope[expert]"` |
| `expert-openai` | 让助手使用 OpenAI 兼容的模型服务方 | `pip install "dashscope[expert-openai]"` |
| `expert-anthropic` | 让助手使用 Anthropic 模型服务方 | `pip install "dashscope[expert-anthropic]"` |
| `expert-voice` | 助手的语音输入与语音播报 | `pip install "dashscope[expert-voice]"` |
| `expert-camera` | 助手的摄像头采集图片输入 | `pip install "dashscope[expert-camera]"` |
| `expert-all` | 以上全部(含 `expert`) | `pip install "dashscope[expert-all]"` |

原有的 `acli*` extra 名作为向后兼容别名保留,依赖完全相同。

从源码安装:

Expand Down Expand Up @@ -515,7 +519,7 @@ SDK 集成了交互式 AI 助手 **DashScope SDK Expert**,由可选依赖 `das

- 直接运行 `dashscope`(不带参数)即可启动助手。首次运行时会提示将 Expert 配置和按领域划分的 Skills 下载到 `./.agenticx/`;之后也可以运行 `agenticx expert download dashscope-sdk-expert` 安装。
- 直接提问代替翻文档 —— 如 `dashscope expert "如何流式输出对话结果"`(一次性提问后退出)。在助手内输入 `/help` 查看可用命令;`dashscope expert --help` 查看全部形式。
- 使用 Python 3.10+ 时,通过 `acli` extra 安装:`pip install "dashscope[acli]"`。需要语音/摄像头输入可加装 `acli-voice` / `acli-camera`,或直接用 `acli-all` 装齐 —— 详见[安装](#安装)一节的 extra 表格。
- 使用 Python 3.10+ 时,通过 `expert` extra 安装:`pip install "dashscope[expert]"`。需要语音/摄像头输入可加装 `expert-voice` / `expert-camera`,或直接用 `expert-all` 装齐 —— 详见[安装](#安装)一节的 extra 表格。
- 完整使用指南:[DashScope SDK Expert 文档](https://help.aliyun.com/zh/model-studio/dashscope-sdk-expert)。

## 命令行
Expand Down
Loading
Loading