volcengine-audio 0.2.2__tar.gz → 0.2.4__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.
- volcengine_audio-0.2.4/.agents/skills/volcengine-audio-doc-sync/SKILL.md +105 -0
- volcengine_audio-0.2.4/.agents/skills/volcengine-audio-doc-sync/agents/openai.yaml +4 -0
- {volcengine_audio-0.2.2 → volcengine_audio-0.2.4}/AGENTS.md +60 -59
- {volcengine_audio-0.2.2 → volcengine_audio-0.2.4}/PKG-INFO +65 -48
- {volcengine_audio-0.2.2 → volcengine_audio-0.2.4}/README.md +63 -46
- {volcengine_audio-0.2.2 → volcengine_audio-0.2.4}/README.zh-CN.md +21 -38
- volcengine_audio-0.2.4/doc_sync/volcengine/1257544-tts_voice_list.md +1034 -0
- {volcengine_audio-0.2.2 → volcengine_audio-0.2.4}/doc_sync/volcengine/1329505-tts_websocket_bidirectional_v3.md +28 -23
- {volcengine_audio-0.2.2 → volcengine_audio-0.2.4}/doc_sync/volcengine/1354869-stt_streaming_bigmodel.md +32 -0
- {volcengine_audio-0.2.2 → volcengine_audio-0.2.4}/doc_sync/volcengine/1594356-realtime_dialogue.md +94 -109
- {volcengine_audio-0.2.2 → volcengine_audio-0.2.4}/doc_sync/volcengine/1598757-tts_http_chunked_sse_v3.md +32 -13
- {volcengine_audio-0.2.2 → volcengine_audio-0.2.4}/doc_sync/volcengine/1719100-tts_websocket_unidirectional_v3.md +28 -23
- {volcengine_audio-0.2.2 → volcengine_audio-0.2.4}/doc_sync/volcengine/manifest.json +64 -12
- {volcengine_audio-0.2.2 → volcengine_audio-0.2.4}/pyproject.toml +2 -2
- volcengine_audio-0.2.4/scripts/sync_volcengine_docs.py +184 -0
- {volcengine_audio-0.2.2 → volcengine_audio-0.2.4}/src/volcengine_audio/__init__.py +1 -1
- {volcengine_audio-0.2.2 → volcengine_audio-0.2.4}/src/volcengine_audio/realtime.py +9 -2
- {volcengine_audio-0.2.2 → volcengine_audio-0.2.4}/src/volcengine_audio/stt.py +3 -0
- {volcengine_audio-0.2.2 → volcengine_audio-0.2.4}/src/volcengine_audio/tts.py +8 -6
- {volcengine_audio-0.2.2 → volcengine_audio-0.2.4}/tests/test_realtime.py +2 -0
- {volcengine_audio-0.2.2 → volcengine_audio-0.2.4}/tests/test_stt.py +11 -0
- {volcengine_audio-0.2.2 → volcengine_audio-0.2.4}/uv.lock +1 -1
- volcengine_audio-0.2.2/scripts/sync_volcengine_docs.py +0 -154
- {volcengine_audio-0.2.2 → volcengine_audio-0.2.4}/.git +0 -0
- {volcengine_audio-0.2.2 → volcengine_audio-0.2.4}/.github/workflows/tests.yml +0 -0
- {volcengine_audio-0.2.2 → volcengine_audio-0.2.4}/.gitignore +0 -0
- {volcengine_audio-0.2.2 → volcengine_audio-0.2.4}/src/volcengine_audio/protocol.py +0 -0
- {volcengine_audio-0.2.2 → volcengine_audio-0.2.4}/tests/test_tts.py +0 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: volcengine-audio-doc-sync
|
|
3
|
+
description: Refresh and reconcile Volcengine Audio SDK documentation snapshots and SDK metadata. Use when working on doc_sync/volcengine snapshots, scripts/sync_volcengine_docs.py, Volcengine upstream doc timestamp changes, README sync dates, or schema/helper drift from Volcengine STT, TTS, or realtime dialogue docs in the volcengine-audio package.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Volcengine Audio Doc Sync
|
|
7
|
+
|
|
8
|
+
## Scope
|
|
9
|
+
|
|
10
|
+
Use this skill for the standalone `volcengine-audio` SDK. Keep all guidance,
|
|
11
|
+
commands, and file paths package-local.
|
|
12
|
+
|
|
13
|
+
Primary package files:
|
|
14
|
+
|
|
15
|
+
- `doc_sync/volcengine/manifest.json`
|
|
16
|
+
- `doc_sync/volcengine/*.md`
|
|
17
|
+
- `scripts/sync_volcengine_docs.py`
|
|
18
|
+
- `src/volcengine_audio/`
|
|
19
|
+
- `tests/`
|
|
20
|
+
- `README.md`
|
|
21
|
+
- `README.zh-CN.md`
|
|
22
|
+
|
|
23
|
+
## Workflow
|
|
24
|
+
|
|
25
|
+
1. Inspect the current tracked snapshots before running network sync:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
git diff -- doc_sync/volcengine
|
|
29
|
+
sed -n '1,220p' doc_sync/volcengine/manifest.json
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
2. If the task asks to refresh upstream docs, run the direct API sync:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
python scripts/sync_volcengine_docs.py
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
3. Diff the refreshed snapshots and manifest. Focus on request fields, enum
|
|
39
|
+
values, event IDs, resource/model names, auth headers, and response payload
|
|
40
|
+
shapes.
|
|
41
|
+
|
|
42
|
+
4. Review linked docs in `manifest.json`:
|
|
43
|
+
|
|
44
|
+
- Check each entry's `linked_document_ids` and the top-level
|
|
45
|
+
`untracked_linked_document_ids`.
|
|
46
|
+
- Add a linked Volcengine doc to `scripts/sync_volcengine_docs.py` when the
|
|
47
|
+
target page carries SDK-relevant enum values, field descriptions,
|
|
48
|
+
resource/model compatibility, event IDs, response payload shapes, or
|
|
49
|
+
speaker/language support tables.
|
|
50
|
+
- Keep credential FAQ, console-operation, setup-only, and marketing links out
|
|
51
|
+
of `DOCS` unless their content becomes part of SDK request/response behavior.
|
|
52
|
+
- If a tracked doc stops being linked or becomes obsolete, verify whether it is
|
|
53
|
+
still a source of SDK behavior before removing it from `DOCS`.
|
|
54
|
+
- For non-Volcengine links that move SDK-critical information, record the link
|
|
55
|
+
in the review notes and decide whether a separate fetch mechanism is needed;
|
|
56
|
+
do not silently ignore it.
|
|
57
|
+
|
|
58
|
+
5. Update SDK code only when the snapshot diff proves API drift:
|
|
59
|
+
|
|
60
|
+
- `stt.py`: request fields, language/audio enums, STT response payloads,
|
|
61
|
+
context data, old/new console auth guidance, and STT error event codes.
|
|
62
|
+
- `tts.py`: resource IDs, `req_params.model`, additions, subtitle/timestamp
|
|
63
|
+
payloads, and response events.
|
|
64
|
+
- `realtime.py`: session config, dialog/asr/tts extra fields, control events,
|
|
65
|
+
context management requests, and acknowledgement payloads.
|
|
66
|
+
- `protocol.py`: shared message types, event IDs, serialization, compression,
|
|
67
|
+
and framing helpers.
|
|
68
|
+
- `__init__.py`: public exports for any new public schema or helper.
|
|
69
|
+
|
|
70
|
+
6. Update package tests for every behavior change. Prefer exact payload
|
|
71
|
+
assertions over partial checks.
|
|
72
|
+
|
|
73
|
+
7. Update README files only with user-facing facts: install/development usage,
|
|
74
|
+
public examples, API reference, package version, and the local sync date or
|
|
75
|
+
source timestamps when they are meant to be public. Keep procedural sync
|
|
76
|
+
checklists in this skill, not in README files.
|
|
77
|
+
|
|
78
|
+
## Snapshot Rules
|
|
79
|
+
|
|
80
|
+
- Store only cleaned upstream `Result.Content` text in tracked `.md` snapshot
|
|
81
|
+
files.
|
|
82
|
+
- Do not store full JSON responses in tracked snapshots.
|
|
83
|
+
- Strip `<span ...>` and `</span>` tags before writing snapshots.
|
|
84
|
+
- Keep source metadata such as `updated_time`, `source_url`, `api_url`, and
|
|
85
|
+
content hashes in `manifest.json`.
|
|
86
|
+
- Keep `linked_document_ids` and `untracked_linked_document_ids` in
|
|
87
|
+
`manifest.json` so new, obsolete, or newly important links are visible in
|
|
88
|
+
future diffs.
|
|
89
|
+
- Snapshot files are tracked for future diffs, but they are not included in the
|
|
90
|
+
wheel because the build packages only `src/volcengine_audio`.
|
|
91
|
+
|
|
92
|
+
## Validation
|
|
93
|
+
|
|
94
|
+
Run focused checks after changing code:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
uv run pytest tests
|
|
98
|
+
uv run ruff check src tests
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
For docs-only changes, at least run:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
git diff --check
|
|
105
|
+
```
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# AGENTS.md
|
|
2
2
|
|
|
3
|
-
Guidance for coding agents working in
|
|
4
|
-
|
|
3
|
+
Guidance for coding agents working in the `volcengine-audio` package
|
|
4
|
+
repository.
|
|
5
5
|
|
|
6
6
|
## 1) What This Package Is
|
|
7
7
|
|
|
@@ -14,10 +14,9 @@ services. It provides typed schemas and request/response helpers for:
|
|
|
14
14
|
- Shared websocket/binary protocol helpers
|
|
15
15
|
|
|
16
16
|
Keep this guide in sync with `README.md`. The README is the user-facing
|
|
17
|
-
package guide and records the local SDK/doc sync date
|
|
18
|
-
timestamps
|
|
19
|
-
|
|
20
|
-
actionable.
|
|
17
|
+
package guide and records the local SDK/doc sync date and tracked upstream
|
|
18
|
+
timestamps; this file carries the agent-facing workflow and code-boundary
|
|
19
|
+
details that make those README claims actionable.
|
|
21
20
|
|
|
22
21
|
Core maintenance entrypoints:
|
|
23
22
|
|
|
@@ -30,7 +29,7 @@ Core maintenance entrypoints:
|
|
|
30
29
|
|
|
31
30
|
## 2) Environment and Dependencies
|
|
32
31
|
|
|
33
|
-
-
|
|
32
|
+
- Local development runtime: Python 3.13
|
|
34
33
|
- Package metadata: `requires-python = ">=3.10"`
|
|
35
34
|
- Package manager: `uv`
|
|
36
35
|
- Build backend: `hatchling`
|
|
@@ -39,11 +38,9 @@ Core maintenance entrypoints:
|
|
|
39
38
|
Useful setup commands:
|
|
40
39
|
|
|
41
40
|
```bash
|
|
42
|
-
# from package root
|
|
43
41
|
uv sync --frozen --group dev
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
uv run pytest packages/volcengine-audio/tests
|
|
42
|
+
uv run pytest tests
|
|
43
|
+
uv run ruff check src tests
|
|
47
44
|
```
|
|
48
45
|
|
|
49
46
|
## 3) Source of Truth
|
|
@@ -57,6 +54,7 @@ first stop during maintenance:
|
|
|
57
54
|
- `doc_sync/volcengine/1719100-tts_websocket_unidirectional_v3.md`
|
|
58
55
|
- `doc_sync/volcengine/1598757-tts_http_chunked_sse_v3.md`
|
|
59
56
|
- `doc_sync/volcengine/1354869-stt_streaming_bigmodel.md`
|
|
57
|
+
- `doc_sync/volcengine/1257544-tts_voice_list.md`
|
|
60
58
|
|
|
61
59
|
These files are tracked in git so future syncs can diff upstream changes
|
|
62
60
|
quickly. They are repo-only maintenance artifacts and are not packed into
|
|
@@ -64,24 +62,30 @@ wheels because the wheel build only includes `src/volcengine_audio`.
|
|
|
64
62
|
|
|
65
63
|
Current tracked upstream timestamps from `manifest.json` and `README.md`:
|
|
66
64
|
|
|
67
|
-
- Realtime dialogue: `2026-
|
|
68
|
-
- TTS WebSocket bidirectional V3: `2026-
|
|
69
|
-
- TTS WebSocket unidirectional V3: `2026-
|
|
70
|
-
- TTS HTTP Chunked/SSE V3: `2026-
|
|
71
|
-
- STT streaming bigmodel: `2026-
|
|
65
|
+
- Realtime dialogue: `2026-06-04T10:15:01Z`
|
|
66
|
+
- TTS WebSocket bidirectional V3: `2026-05-25T08:51:30Z`
|
|
67
|
+
- TTS WebSocket unidirectional V3: `2026-05-25T08:49:18Z`
|
|
68
|
+
- TTS HTTP Chunked/SSE V3: `2026-05-25T09:03:36Z`
|
|
69
|
+
- STT streaming bigmodel: `2026-05-29T02:49:48Z`
|
|
70
|
+
- TTS voice list: `2026-05-26T05:41:00Z`
|
|
72
71
|
|
|
73
72
|
Latest local sync review:
|
|
74
73
|
|
|
75
|
-
- Local sync date in README: `2026-
|
|
76
|
-
- Realtime docs added
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
`
|
|
80
|
-
- STT docs
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
- TTS docs
|
|
84
|
-
|
|
74
|
+
- Local sync date in README: `2026-06-06`.
|
|
75
|
+
- Realtime docs added 12K 2.0 context notes, O/SC convergence wording,
|
|
76
|
+
updated SC2.0 voice-list references, `tts.extra.tts_2.0_model`, and a
|
|
77
|
+
10w TPM default. The SDK exposes this as `tts_2_0_model` with the wire alias
|
|
78
|
+
`tts_2.0_model`.
|
|
79
|
+
- STT docs added non-streaming `enable_auto_lang` for automatic language
|
|
80
|
+
detection across 25 locales. The SDK request schema includes
|
|
81
|
+
`enable_auto_lang`.
|
|
82
|
+
- TTS docs now describe the TTS 2.0 default model as
|
|
83
|
+
`seed-tts-2.0-standard`, expand ICL2.0 explicit-language guidance, and
|
|
84
|
+
clarify `context_texts`, `section_id`, and `use_tag_parser`. The existing SDK
|
|
85
|
+
fields cover those parameters.
|
|
86
|
+
- TTS voice-list doc `1257544` is now tracked because the API docs delegate
|
|
87
|
+
speaker, model/resource compatibility, voice ability, and language support
|
|
88
|
+
details to that page. The SDK still keeps speaker fields open as `str`.
|
|
85
89
|
|
|
86
90
|
Snapshot format guidance:
|
|
87
91
|
|
|
@@ -91,21 +95,21 @@ Snapshot format guidance:
|
|
|
91
95
|
diffs stay readable.
|
|
92
96
|
- Keep metadata such as `updated_time`, `source_url`, `api_url`, and the
|
|
93
97
|
content hash in `manifest.json`.
|
|
98
|
+
- Review `linked_document_ids` and `untracked_linked_document_ids` in
|
|
99
|
+
`manifest.json` after each sync. Add linked Volcengine docs to
|
|
100
|
+
`scripts/sync_volcengine_docs.py` when they carry SDK-relevant enum values,
|
|
101
|
+
field descriptions, resource/model compatibility, event IDs, or response
|
|
102
|
+
shapes. Do not add credential FAQ, console operation, or setup-only links
|
|
103
|
+
unless their content becomes part of SDK behavior.
|
|
94
104
|
|
|
95
105
|
## 4) Quality and Static Checks
|
|
96
106
|
|
|
97
107
|
Run what is relevant for the change:
|
|
98
108
|
|
|
99
109
|
```bash
|
|
100
|
-
# from package root
|
|
101
110
|
uv run ruff check src tests
|
|
102
111
|
uv run ruff format src tests
|
|
103
112
|
uv run pytest
|
|
104
|
-
|
|
105
|
-
# from repo root
|
|
106
|
-
uv run ruff check packages/volcengine-audio/src packages/volcengine-audio/tests
|
|
107
|
-
uv run ruff format packages/volcengine-audio/src packages/volcengine-audio/tests
|
|
108
|
-
uv run pytest packages/volcengine-audio/tests
|
|
109
113
|
```
|
|
110
114
|
|
|
111
115
|
## 5) Testing
|
|
@@ -116,13 +120,13 @@ Useful commands:
|
|
|
116
120
|
|
|
117
121
|
```bash
|
|
118
122
|
# full package suite
|
|
119
|
-
uv run pytest
|
|
123
|
+
uv run pytest tests
|
|
120
124
|
|
|
121
125
|
# targeted file
|
|
122
|
-
uv run pytest
|
|
126
|
+
uv run pytest tests/test_realtime.py
|
|
123
127
|
|
|
124
128
|
# targeted test selection
|
|
125
|
-
uv run pytest
|
|
129
|
+
uv run pytest tests -k tts
|
|
126
130
|
```
|
|
127
131
|
|
|
128
132
|
Testing expectations:
|
|
@@ -132,8 +136,6 @@ Testing expectations:
|
|
|
132
136
|
- Prefer exact payload assertions over loose partial checks.
|
|
133
137
|
- Cover both request generation and response parsing when protocol behavior
|
|
134
138
|
changes.
|
|
135
|
-
- Do not use the dispatcher Docker test wrapper for this package unless the
|
|
136
|
-
change truly depends on repo-level integration.
|
|
137
139
|
|
|
138
140
|
## 6) Repo Map
|
|
139
141
|
|
|
@@ -144,7 +146,7 @@ Testing expectations:
|
|
|
144
146
|
- `src/volcengine_audio/__init__.py`: public exports
|
|
145
147
|
- `tests/`: package-level regression coverage
|
|
146
148
|
- `doc_sync/volcengine/`: tracked upstream snapshots and manifest
|
|
147
|
-
- `scripts/sync_volcengine_docs.py`:
|
|
149
|
+
- `scripts/sync_volcengine_docs.py`: direct API doc sync utility
|
|
148
150
|
- `README.md`: English package guide and sync metadata
|
|
149
151
|
- `README.zh-CN.md`: Chinese package guide and sync metadata
|
|
150
152
|
|
|
@@ -153,30 +155,29 @@ Testing expectations:
|
|
|
153
155
|
Refresh docs with:
|
|
154
156
|
|
|
155
157
|
```bash
|
|
156
|
-
|
|
158
|
+
python scripts/sync_volcengine_docs.py
|
|
157
159
|
```
|
|
158
160
|
|
|
159
161
|
What the script does:
|
|
160
162
|
|
|
161
|
-
1.
|
|
162
|
-
2.
|
|
163
|
-
3. Extracts only `Result.Content`, removes span tags, and writes a `.md`
|
|
163
|
+
1. Requests each public `api/doc/getDocDetail` JSON response directly.
|
|
164
|
+
2. Extracts only `Result.Content`, removes span tags, and writes a `.md`
|
|
164
165
|
snapshot for each tracked doc.
|
|
165
|
-
|
|
166
|
+
3. Writes `manifest.json` with source metadata, content hashes, and linked
|
|
167
|
+
Volcengine doc IDs.
|
|
166
168
|
|
|
167
169
|
Important notes:
|
|
168
170
|
|
|
169
|
-
-
|
|
170
|
-
|
|
171
|
-
- Prefer Playwright response interception over raw `curl` scraping.
|
|
171
|
+
- Fetch all docs successfully before clearing old snapshots so a failed sync
|
|
172
|
+
does not leave the snapshot directory empty.
|
|
172
173
|
- If the task is only to sync `AGENTS.md` or `README.md` with already-tracked
|
|
173
|
-
snapshots, do not rerun
|
|
174
|
-
and `git diff -- doc_sync/volcengine` instead.
|
|
174
|
+
snapshots, do not rerun the sync script. Read `manifest.json`, the README
|
|
175
|
+
files, and `git diff -- doc_sync/volcengine` instead.
|
|
175
176
|
|
|
176
177
|
## 8) Coding Standards (Package-Specific)
|
|
177
178
|
|
|
178
|
-
- Keep the package standalone; do not import
|
|
179
|
-
`src/volcengine_audio`.
|
|
179
|
+
- Keep the package standalone; do not import code from outside this package
|
|
180
|
+
into `src/volcengine_audio`.
|
|
180
181
|
- Use `orjson` for JSON operations in package code when serialization is
|
|
181
182
|
needed.
|
|
182
183
|
- Prefer modern typing syntax such as `list[str]` and `str | None`.
|
|
@@ -240,9 +241,9 @@ Formatting from repo config:
|
|
|
240
241
|
Useful commands:
|
|
241
242
|
|
|
242
243
|
```bash
|
|
243
|
-
git diff --
|
|
244
|
-
git diff --
|
|
245
|
-
rg -n "keep_alive|push_to_talk|concurr|UpdatedTime"
|
|
244
|
+
git diff -- doc_sync/volcengine
|
|
245
|
+
git diff -- src/volcengine_audio
|
|
246
|
+
rg -n "keep_alive|push_to_talk|concurr|UpdatedTime" .
|
|
246
247
|
```
|
|
247
248
|
|
|
248
249
|
High-signal fields to watch:
|
|
@@ -260,8 +261,8 @@ High-signal fields to watch:
|
|
|
260
261
|
Run at least:
|
|
261
262
|
|
|
262
263
|
```bash
|
|
263
|
-
uv run pytest
|
|
264
|
-
uv run ruff check
|
|
264
|
+
uv run pytest tests
|
|
265
|
+
uv run ruff check src tests
|
|
265
266
|
```
|
|
266
267
|
|
|
267
268
|
Also confirm:
|
|
@@ -277,8 +278,8 @@ Before finishing code changes, run what is relevant:
|
|
|
277
278
|
1. Refresh doc snapshots if the task is an upstream sync.
|
|
278
279
|
2. Run targeted package tests via `uv run pytest ...`.
|
|
279
280
|
3. Run `uv run ruff check ...`.
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
281
|
+
|
|
282
|
+
4. Confirm no secrets or temporary scrape artifacts were added to tracked files.
|
|
283
|
+
5. Add docstrings and type annotations for new best-effort public code.
|
|
284
|
+
6. Update nearby docs in the same change if behavior or maintenance workflow
|
|
284
285
|
changed materially.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: volcengine-audio
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: Python SDK for Volcengine Audio Services (TTS, STT, and Realtime Dialogue)
|
|
5
5
|
Project-URL: Homepage, https://github.com/aiyou178/volcengine-audio
|
|
6
6
|
Project-URL: Issues, https://github.com/aiyou178/volcengine-audio/issues
|
|
@@ -22,7 +22,7 @@ Requires-Python: >=3.10
|
|
|
22
22
|
Requires-Dist: orjson
|
|
23
23
|
Requires-Dist: pydantic<3.0,>=2.0
|
|
24
24
|
Provides-Extra: dev
|
|
25
|
-
Requires-Dist: pytest-asyncio>=1.
|
|
25
|
+
Requires-Dist: pytest-asyncio>=1.4.0; extra == 'dev'
|
|
26
26
|
Requires-Dist: pytest-randomly>=3.16.0; extra == 'dev'
|
|
27
27
|
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
28
28
|
Requires-Dist: ruff>=0.11.0; extra == 'dev'
|
|
@@ -42,41 +42,26 @@ Python SDK for Volcengine (ByteDance) Audio Services, providing comprehensive su
|
|
|
42
42
|
- **Protocol Support**: Low-level protocol utilities for custom implementations
|
|
43
43
|
- **Type Safety**: Full Pydantic model validation for all requests and responses
|
|
44
44
|
|
|
45
|
-
## Documentation
|
|
45
|
+
## Documentation
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
Last SDK/doc sync: `2026-06-06`.
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
* Package maintenance guide: [`AGENTS.md`](AGENTS.md)
|
|
51
|
-
* Snapshot manifest: [`doc_sync/volcengine/manifest.json`](doc_sync/volcengine/manifest.json)
|
|
52
|
-
* Refresh command: `uvx --with playwright python packages/volcengine-audio/scripts/sync_volcengine_docs.py`
|
|
53
|
-
* These Volcengine docs are JS-rendered. The sync script opens the public docs pages with Playwright, captures the backing `api/doc/getDocDetail` JSON response, and writes cleaned `Result.Content` markdown snapshots to `doc_sync/volcengine/`.
|
|
54
|
-
* The tracked snapshot files store only doc content text with span tags removed, while source metadata stays in `manifest.json`.
|
|
55
|
-
* The snapshot files are tracked in git for future diffs, but they are not packed into wheels because this package only ships `src/volcengine_audio`.
|
|
56
|
-
* Latest upstream review: May 2026 doc updates changed realtime dialogue protocol coverage and auth/documentation wording. The SDK now includes the refreshed realtime control events, conversation truncation helpers, realtime `tts.extra` metadata, STT `X-Api-Key` guidance in snapshots, and TTS billing wording updates.
|
|
49
|
+
### Current Tracked Sources
|
|
57
50
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
* STT streaming bigmodel: `2026-04-27T03:14:54Z` - <https://www.volcengine.com/docs/6561/1354869?lang=zh>
|
|
65
|
-
|
|
66
|
-
### Sync checklist
|
|
67
|
-
|
|
68
|
-
1. Refresh the tracked content snapshots with `uvx --with playwright python packages/volcengine-audio/scripts/sync_volcengine_docs.py`.
|
|
69
|
-
2. Diff `doc_sync/volcengine/*.md` to see which request fields, enums, events, or examples changed upstream.
|
|
70
|
-
3. Update `src/volcengine_audio/` schemas and helper functions as needed.
|
|
71
|
-
4. Update or add tests under `tests/`.
|
|
72
|
-
5. Update the local sync date in this README and in [`README.zh-CN.md`](README.zh-CN.md).
|
|
51
|
+
- Realtime dialogue: `2026-06-04T10:15:01Z` - <https://www.volcengine.com/docs/6561/1594356?lang=zh>
|
|
52
|
+
- TTS WebSocket bidirectional V3: `2026-05-25T08:51:30Z` - <https://www.volcengine.com/docs/6561/1329505?lang=zh>
|
|
53
|
+
- TTS WebSocket unidirectional V3: `2026-05-25T08:49:18Z` - <https://www.volcengine.com/docs/6561/1719100?lang=zh>
|
|
54
|
+
- TTS HTTP Chunked/SSE V3: `2026-05-25T09:03:36Z` - <https://www.volcengine.com/docs/6561/1598757?lang=zh>
|
|
55
|
+
- STT streaming bigmodel: `2026-05-29T02:49:48Z` - <https://www.volcengine.com/docs/6561/1354869?lang=zh>
|
|
56
|
+
- TTS voice list: `2026-05-26T05:41:00Z` - <https://www.volcengine.com/docs/6561/1257544?lang=zh>
|
|
73
57
|
|
|
74
58
|
## Installation
|
|
75
59
|
|
|
60
|
+
Requires Python 3.10 or newer.
|
|
61
|
+
|
|
76
62
|
### Install from PyPI
|
|
77
63
|
|
|
78
64
|
```bash
|
|
79
|
-
# From PyPI (when published)
|
|
80
65
|
pip install volcengine-audio
|
|
81
66
|
```
|
|
82
67
|
|
|
@@ -88,6 +73,19 @@ cd volcengine-audio
|
|
|
88
73
|
pip install -e .
|
|
89
74
|
```
|
|
90
75
|
|
|
76
|
+
## Development
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# from this repository root
|
|
80
|
+
uv sync --frozen --group dev
|
|
81
|
+
uv run pytest tests
|
|
82
|
+
uv run ruff check src tests
|
|
83
|
+
uv run ruff format src tests
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
This package is a standalone SDK. Keep source under `src/volcengine_audio` and
|
|
87
|
+
tests under `tests`.
|
|
88
|
+
|
|
91
89
|
## Quick Start
|
|
92
90
|
|
|
93
91
|
### Speech-to-Text (STT)
|
|
@@ -228,13 +226,21 @@ finish = RealtimeDialogueFunctions.finish_session_payload("session-123")
|
|
|
228
226
|
|
|
229
227
|
Core protocol definitions and utilities.
|
|
230
228
|
|
|
229
|
+
**Package Metadata:**
|
|
230
|
+
- `__version__`: Installed package version
|
|
231
|
+
|
|
231
232
|
**Classes:**
|
|
232
233
|
- `ProtocolVersion`: Protocol version enumeration (V1)
|
|
234
|
+
- `HeaderSize`: Protocol header size enumeration
|
|
233
235
|
- `MessageType`: Message types for bidirectional communication
|
|
236
|
+
- `MessageTypeSpecificFlag`: Message flags for sequencing and event framing
|
|
237
|
+
- `AsrMessageType`: ASR-specific message types
|
|
238
|
+
- `AsrMessageTypeSpecificFlag`: ASR-specific message flags
|
|
234
239
|
- `EventSend`: Events sent from client to server
|
|
235
240
|
- `EventReceive`: Events received from server
|
|
236
241
|
- `SerializationMethod`: Payload serialization methods (JSON, RAW, PROTOBUF)
|
|
237
242
|
- `CompressionMethod`: Payload compression methods (NONE, GZIP)
|
|
243
|
+
- `AudioCodec`: Audio codec values used by STT request schemas
|
|
238
244
|
|
|
239
245
|
**Constants:**
|
|
240
246
|
- `HOST`: `'openspeech.bytedance.com'` - Volcengine audio service host
|
|
@@ -249,6 +255,7 @@ Speech-to-Text (ASR) models and utilities.
|
|
|
249
255
|
|
|
250
256
|
**Request Models:**
|
|
251
257
|
- `VolcengineAsrRequestV3`: ASR V3 API request
|
|
258
|
+
- `request.enable_auto_lang`: Auto-detect language for non-streaming STT
|
|
252
259
|
- `VolcengineAsrRequestV2`: ASR V2 API request
|
|
253
260
|
|
|
254
261
|
**Response Models:**
|
|
@@ -258,13 +265,17 @@ Speech-to-Text (ASR) models and utilities.
|
|
|
258
265
|
**Enums:**
|
|
259
266
|
- `STTResource`: STT resource types for billing
|
|
260
267
|
- `STTAudioFormatV3`: Audio formats (pcm, wav, mp3, ogg)
|
|
268
|
+
- `AudioFormatV2`: Audio formats for the V2 request schema
|
|
261
269
|
- `STTResultType`: Result types (full, single)
|
|
262
270
|
- `STTBigmodelNoStreamLanguage`: Supported languages for bigmodel
|
|
263
271
|
|
|
264
272
|
**Helper Classes:**
|
|
265
273
|
- `VolcengineAsrFunctionsV3`: V3 API helper functions
|
|
274
|
+
- `generate_asr_header()`: Generate V3 ASR request headers
|
|
275
|
+
- `generate_asr_before_payload()`: Generate V3 ASR sequence metadata
|
|
266
276
|
- `generate_asr_full_client_request()`: Generate full client request
|
|
267
277
|
- `generate_asr_audio_only_request()`: Generate audio-only request
|
|
278
|
+
- `parse_request()`: Parse generated request bytes for inspection
|
|
268
279
|
- `parse_response()`: Parse server response
|
|
269
280
|
- `VolcengineAsrFunctionsV2`: V2 API helper functions
|
|
270
281
|
- `full_client_request()`: Generate full client request
|
|
@@ -283,19 +294,35 @@ Text-to-Speech models and utilities.
|
|
|
283
294
|
- `TTSSentenceStartResponse`: Sentence start notification
|
|
284
295
|
- `TTSSentenceEndResponse`: Sentence end notification
|
|
285
296
|
- `TTSEndResponse`: TTS ended notification
|
|
297
|
+
- `TTSSentenceEndPayload`: Sentence-end payload typed dict
|
|
298
|
+
- `TTSSubtitlePayload`: Subtitle payload typed dict
|
|
299
|
+
- `TTSTimedWord`: Timed word typed dict
|
|
286
300
|
|
|
287
301
|
**Enums:**
|
|
288
302
|
- `TTSBigmodelResourceType`: TTS resource IDs (`seed-tts-1.0`, `seed-tts-2.0`, etc.)
|
|
289
303
|
- `TTSBigmodelModelType`: Optional `req_params.model` values (`seed-tts-1.1`, `seed-tts-2.0-standard`, etc.)
|
|
290
304
|
- `TTSAudioFormat`: Audio formats (wav, pcm, mp3, ogg_opus)
|
|
305
|
+
- `OperationEnum`: HTTP TTS operation values
|
|
306
|
+
|
|
307
|
+
**Configuration Models:**
|
|
308
|
+
- `AppConfig`: HTTP TTS app credentials and cluster
|
|
309
|
+
- `UserConfig`: User identifier for request metadata
|
|
310
|
+
- `AudioConfig`: HTTP TTS audio options
|
|
311
|
+
- `RequestConfig`: HTTP TTS request options
|
|
291
312
|
|
|
292
313
|
**Helper Classes:**
|
|
293
314
|
- `VolcengineTTSFunctions`: TTS API helper functions
|
|
315
|
+
- `prepare_request()`: Prepare HTTP TTS request payload
|
|
316
|
+
- `task_request_payload()`: Generate bidirectional task payload
|
|
294
317
|
- `start_connection_payload()`: Start connection
|
|
295
318
|
- `start_session_payload()`: Start TTS session
|
|
319
|
+
- `cancel_session_payload()`: Cancel TTS session
|
|
296
320
|
- `finish_session_payload()`: Finish TTS session
|
|
321
|
+
- `finish_connection_payload()`: Finish connection
|
|
297
322
|
- `extract_response_payload()`: Extract and parse response
|
|
298
323
|
- `calculate_payload()`: Calculate request payload
|
|
324
|
+
- `validate_tts_resource_model_mapping()`: Validate compatible resource/model
|
|
325
|
+
pairs for TTS 1.x and 2.x resources
|
|
299
326
|
|
|
300
327
|
#### `volcengine_audio.realtime`
|
|
301
328
|
|
|
@@ -304,7 +331,8 @@ Realtime dialogue (combined TTS+STT) models and utilities.
|
|
|
304
331
|
**Configuration:**
|
|
305
332
|
- `RealtimeDialogueConfig`: Complete dialogue session configuration
|
|
306
333
|
- `DialogConfig`: Bot persona, speaking style, location
|
|
307
|
-
- `TTSConfig`: Voice type and
|
|
334
|
+
- `TTSConfig`: Voice type, audio settings, and `tts_2_0_model` wire alias
|
|
335
|
+
`tts_2.0_model`
|
|
308
336
|
- `Asr`: ASR-specific settings
|
|
309
337
|
|
|
310
338
|
**Request Models:**
|
|
@@ -323,12 +351,16 @@ Realtime dialogue (combined TTS+STT) models and utilities.
|
|
|
323
351
|
- `ChatTextQueryConfirmedResponse`: Text query acknowledgement
|
|
324
352
|
- `ConversationCreatedResponse`, `ConversationUpdatedResponse`, `ConversationRetrievedResponse`, `ConversationTruncatedResponse`, `ConversationDeletedResponse`: Context management acknowledgements
|
|
325
353
|
- `ConfigUpdatedResponse`: Runtime config update acknowledgement
|
|
354
|
+
- `ConnectionFailedResponse`: Connection-level failure payload
|
|
326
355
|
- `SessionStartedResponse`: Session started
|
|
327
356
|
- `SessionFailedResponse`: Session failed
|
|
357
|
+
- `RealtimeDialogueErrorResponse`: Generic realtime error payload
|
|
358
|
+
- `RealtimeDialogueUsage`: Usage typed dict
|
|
328
359
|
|
|
329
360
|
**Helper Classes:**
|
|
330
361
|
- `RealtimeDialogueFunctions`: Realtime dialogue API helpers
|
|
331
362
|
- `start_connection_payload()`: Start connection
|
|
363
|
+
- `finish_connection_payload()`: Finish connection
|
|
332
364
|
- `start_session_payload()`: Start dialogue session
|
|
333
365
|
- `task_request_payload()`: Send audio for recognition
|
|
334
366
|
- `update_config_payload()`: Update runtime TTS/dialog config
|
|
@@ -538,9 +570,11 @@ config = RealtimeDialogueConfig(
|
|
|
538
570
|
## Error Handling
|
|
539
571
|
|
|
540
572
|
```python
|
|
541
|
-
from volcengine_audio import EventReceive
|
|
573
|
+
from volcengine_audio import EventReceive, VolcengineTTSFunctions
|
|
542
574
|
|
|
543
|
-
event, session_id, payload = VolcengineTTSFunctions.extract_response_payload(
|
|
575
|
+
event, session_id, payload = VolcengineTTSFunctions.extract_response_payload(
|
|
576
|
+
response
|
|
577
|
+
)
|
|
544
578
|
|
|
545
579
|
if event == EventReceive.SessionFailed:
|
|
546
580
|
print(f"Session failed: {payload.get('error')}")
|
|
@@ -550,23 +584,6 @@ elif event == EventReceive.SERVER_PROCESSING_ERROR:
|
|
|
550
584
|
print("Server processing error")
|
|
551
585
|
```
|
|
552
586
|
|
|
553
|
-
## Development
|
|
554
|
-
|
|
555
|
-
### Running Tests
|
|
556
|
-
|
|
557
|
-
```bash
|
|
558
|
-
pytest tests/
|
|
559
|
-
```
|
|
560
|
-
|
|
561
|
-
### Code Style
|
|
562
|
-
|
|
563
|
-
This package uses Ruff for linting and formatting:
|
|
564
|
-
|
|
565
|
-
```bash
|
|
566
|
-
ruff check src/ tests/
|
|
567
|
-
ruff format src/ tests/
|
|
568
|
-
```
|
|
569
|
-
|
|
570
587
|
## License
|
|
571
588
|
|
|
572
589
|
MIT
|