soniox 2.0.0__tar.gz → 2.2.0__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 (53) hide show
  1. soniox-2.2.0/CHANGELOG.md +123 -0
  2. {soniox-2.0.0 → soniox-2.2.0}/PKG-INFO +24 -14
  3. {soniox-2.0.0 → soniox-2.2.0}/README.md +22 -12
  4. soniox-2.2.0/docs/async_client.md +1024 -0
  5. soniox-2.2.0/docs/realtime_client.md +899 -0
  6. soniox-2.2.0/docs/types.md +569 -0
  7. {soniox-2.0.0 → soniox-2.2.0}/examples/async_soniox_client/api_example.py +4 -4
  8. {soniox-2.0.0 → soniox-2.2.0}/examples/async_soniox_client/realtime_example.py +1 -1
  9. {soniox-2.0.0 → soniox-2.2.0}/examples/soniox_client/api_example.py +4 -4
  10. {soniox-2.0.0 → soniox-2.2.0}/examples/soniox_client/realtime_example.py +1 -1
  11. soniox-2.2.0/justfile +53 -0
  12. {soniox-2.0.0 → soniox-2.2.0}/pyproject.toml +2 -2
  13. soniox-2.2.0/scripts/generate_docs.py +1122 -0
  14. {soniox-2.0.0 → soniox-2.2.0}/src/soniox/api/__init__.py +4 -4
  15. {soniox-2.0.0 → soniox-2.2.0}/src/soniox/api/async_files.py +27 -10
  16. soniox-2.0.0/src/soniox/api/async_transcriptions.py → soniox-2.2.0/src/soniox/api/async_stt.py +39 -10
  17. {soniox-2.0.0 → soniox-2.2.0}/src/soniox/api/files.py +25 -10
  18. soniox-2.0.0/src/soniox/api/transcriptions.py → soniox-2.2.0/src/soniox/api/stt.py +38 -11
  19. {soniox-2.0.0 → soniox-2.2.0}/src/soniox/client.py +8 -8
  20. soniox-2.2.0/src/soniox/realtime/_utils.py +94 -0
  21. {soniox-2.0.0 → soniox-2.2.0}/src/soniox/realtime/async_stt.py +65 -5
  22. {soniox-2.0.0 → soniox-2.2.0}/src/soniox/realtime/stt.py +63 -5
  23. soniox-2.2.0/src/soniox/types/api.py +434 -0
  24. {soniox-2.0.0 → soniox-2.2.0}/src/soniox/types/common.py +18 -0
  25. {soniox-2.0.0 → soniox-2.2.0}/src/soniox/types/realtime.py +46 -42
  26. {soniox-2.0.0 → soniox-2.2.0}/src/soniox/types/webhooks.py +8 -0
  27. {soniox-2.0.0 → soniox-2.2.0}/src/soniox/utils.py +1 -56
  28. soniox-2.2.0/uv.lock +417 -0
  29. soniox-2.0.0/docs/python-sdk.md +0 -2748
  30. soniox-2.0.0/mkdocs.yml +0 -39
  31. soniox-2.0.0/pydoc-markdown.yml +0 -16
  32. soniox-2.0.0/src/soniox/types/api.py +0 -233
  33. soniox-2.0.0/tests/__init__.py +0 -0
  34. soniox-2.0.0/tests/test_story_api_contracts.py +0 -75
  35. soniox-2.0.0/tests/test_story_streaming_utils.py +0 -53
  36. soniox-2.0.0/uv.lock +0 -1139
  37. {soniox-2.0.0 → soniox-2.2.0}/.gitignore +0 -0
  38. {soniox-2.0.0 → soniox-2.2.0}/LICENSE +0 -0
  39. {soniox-2.0.0 → soniox-2.2.0}/assets/coffee_shop.mp3 +0 -0
  40. {soniox-2.0.0 → soniox-2.2.0}/assets/coffee_shop.pcm_s16le +0 -0
  41. {soniox-2.0.0 → soniox-2.2.0}/assets/two_way_translation.mp3 +0 -0
  42. {soniox-2.0.0 → soniox-2.2.0}/assets/two_way_translation.pcm_s16le +0 -0
  43. {soniox-2.0.0 → soniox-2.2.0}/src/soniox/__init__.py +0 -0
  44. {soniox-2.0.0 → soniox-2.2.0}/src/soniox/api/_utils.py +0 -0
  45. {soniox-2.0.0 → soniox-2.2.0}/src/soniox/api/async_auth.py +0 -0
  46. {soniox-2.0.0 → soniox-2.2.0}/src/soniox/api/async_models.py +0 -0
  47. {soniox-2.0.0 → soniox-2.2.0}/src/soniox/api/async_webhooks.py +0 -0
  48. {soniox-2.0.0 → soniox-2.2.0}/src/soniox/api/auth.py +0 -0
  49. {soniox-2.0.0 → soniox-2.2.0}/src/soniox/api/models.py +0 -0
  50. {soniox-2.0.0 → soniox-2.2.0}/src/soniox/api/webhooks.py +0 -0
  51. {soniox-2.0.0 → soniox-2.2.0}/src/soniox/errors.py +0 -0
  52. {soniox-2.0.0 → soniox-2.2.0}/src/soniox/realtime/__init__.py +0 -0
  53. {soniox-2.0.0 → soniox-2.2.0}/src/soniox/types/__init__.py +0 -0
@@ -0,0 +1,123 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is inspired by Keep a Changelog and this project follows Semantic Versioning.
6
+
7
+ ## Quick Guide for Contributors
8
+
9
+ - Every PR that changes behavior must update **[Unreleased]**.
10
+ - Write from the **user’s perspective** (what changed for SDK users).
11
+ - Keep entries short (one clear sentence).
12
+ - Use the correct section: **Added**, **Changed**, **Fixed**, **Deprecated**, **Removed**, **Security**.
13
+ - Avoid internal details or commit-style messages.
14
+
15
+ **Release process (maintainers):**
16
+
17
+ - Rename **[Unreleased]** → new version + date.
18
+ - Add a fresh empty **[Unreleased]** section at the top.
19
+
20
+ ### Version Categories Guide
21
+
22
+ Use the following categories when adding entries:
23
+
24
+ - **Added** — new features or capabilities.
25
+ - **Changed** — updates to existing functionality.
26
+ - **Deprecated** — features that will be removed soon.
27
+ - **Removed** — features removed in this version.
28
+ - **Fixed** — bug fixes.
29
+ - **Security** — vulnerability fixes.
30
+
31
+ ---
32
+
33
+ ### Writing Guidelines
34
+
35
+ - Write entries from the **user's perspective**, not implementation details.
36
+ - ✅ "Added async file uploads"
37
+ - ❌ "Refactored upload handler"
38
+
39
+ - Keep lines short and scannable.
40
+ - Group related changes into one bullet when possible.
41
+ - Avoid commit-message noise.
42
+ - Every released version should have a date.
43
+
44
+ ---
45
+
46
+ ### Versioning Notes
47
+
48
+ This project follows Semantic Versioning:
49
+
50
+ - **MAJOR** version when you make incompatible API changes.
51
+ - **MINOR** version when you add functionality in a backward-compatible manner.
52
+ - **PATCH** version when you make backward-compatible bug fixes.
53
+
54
+ Examples:
55
+
56
+ - `1.0.0` — stable API
57
+ - `1.1.0` — new features added
58
+ - `1.1.1` — bug fixes only
59
+
60
+ ---
61
+
62
+ ## [Unreleased]
63
+
64
+ ### Added
65
+
66
+ -
67
+
68
+ ### Changed
69
+
70
+ -
71
+
72
+ ### Fixed
73
+
74
+ -
75
+
76
+ ### Removed
77
+
78
+ ---
79
+
80
+ ## [2.2.0] - 25 feb 2026
81
+
82
+ ### Added
83
+
84
+ - max_endpoint_delay_ms parameter (v4 model only)
85
+ - fin (<fin>) and end (<end>) constants
86
+ - validation for TranslationConfig
87
+
88
+ ### Changed
89
+
90
+ - Improved docs generating script
91
+
92
+ ---
93
+
94
+ ## [2.1.0] - 18 feb 2026
95
+
96
+ ### Added
97
+
98
+ - pause and resume methods
99
+ - destroy_all method (removes all transcriptions and all files)
100
+ - send_bytes accepts finish parameter
101
+
102
+ ### Changed
103
+
104
+ - renamed client.transcriptions to 'client.stt'
105
+ - removed send\_ prefix from methods (i.e. send_keep_alive -> keep_alive)
106
+
107
+ ### Removed
108
+
109
+ - keep alive helpers (use pause, resume, or manually send keepalive message)
110
+
111
+ ---
112
+
113
+ ## [2.0.0] - 3 feb 2026
114
+
115
+ ### Added
116
+
117
+ - Initial public release of the Python SDK.
118
+ - Core client implementation (sync and async).
119
+ - Full support for REST API and websocket API
120
+
121
+ ### Removed
122
+
123
+ - Old Soniox Python SDK (versions 1._._)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: soniox
3
- Version: 2.0.0
3
+ Version: 2.2.0
4
4
  Summary: The official Python SDK for the Soniox API (STT, REST)
5
5
  Project-URL: Homepage, https://sonoix.com
6
6
  Project-URL: Documentation, https://soniox.com/docs
@@ -30,14 +30,15 @@ Requires-Dist: httpx>0.25.0
30
30
  Requires-Dist: pydantic>2
31
31
  Requires-Dist: websockets>11.0
32
32
  Provides-Extra: dev
33
- Requires-Dist: pydoc-markdown>=4.8.2; extra == 'dev'
33
+ Requires-Dist: griffe>=1.15.0; extra == 'dev'
34
34
  Requires-Dist: pyright>=1.1.0; extra == 'dev'
35
35
  Requires-Dist: ruff>=0.0.0; extra == 'dev'
36
36
  Description-Content-Type: text/markdown
37
37
 
38
38
  # Soniox Python SDK
39
39
 
40
- The SDK exposes two clients: `SonioxClient` (sync) and `AsyncSonioxClient`. Client can hit every Soniox REST endpoint or open a realtime websocket session without wiring headers, retries, or payload validation yourself. Auth, file uploads, transcription polling, webhook helpers, and realtime stream helpers all live in one typed package.
40
+ The SDK exposes two clients: `SonioxClient` (sync) and `AsyncSonioxClient`. Client can hit every Soniox REST endpoint or open a real-time websocket session, so you can focus on building features instead of dealing with boilerplate.
41
+ Auth, file uploads, transcription polling, webhook helpers, and real-time stream helpers all live in one typed package.
41
42
 
42
43
  ## Install
43
44
 
@@ -50,7 +51,7 @@ export SONIOX_API_KEY=<your-key>
50
51
 
51
52
  Get your API key from the [Soniox Console](https://console.soniox.com) and inject it once per shell session. Both clients read `SONIOX_API_KEY` by default, but you can override it per-client if needed.
52
53
 
53
- ## Quick run (rest + realtime)
54
+ ## Quick run (rest + real-time)
54
55
 
55
56
  1. **REST transcription**: copy this snippet or run [`examples/soniox_client/api_example.py`](https://github.com/soniox/soniox-python/blob/main/examples/soniox_client/api_example.py).
56
57
 
@@ -58,15 +59,15 @@ Get your API key from the [Soniox Console](https://console.soniox.com) and injec
58
59
  from soniox import SonioxClient
59
60
 
60
61
  client = SonioxClient()
61
- transcription = client.transcriptions.transcribe(
62
+ transcription = client.stt.transcribe(
62
63
  audio_url="https://soniox.com/media/examples/coffee_shop.mp3",
63
64
  client_reference_id="docs-quick-start",
64
65
  )
65
- client.transcriptions.wait(transcription.id, timeout_sec=60)
66
- print(client.transcriptions.get_transcript(transcription.id).text[:200])
66
+ client.stt.wait(transcription.id, timeout_sec=60)
67
+ print(client.stt.get_transcript(transcription.id).text[:200])
67
68
  ```
68
69
 
69
- 2. **Realtime streaming**: the realtime helpers mirror the sync rest sample—open `client.realtime.stt.connect`, call `session.send_byte_chunk` or `session.send_bytes`, then iterate `session.receive_events()` to render tokens. example:
70
+ 2. **Real-time streaming**: the real-time helpers mirror the sync rest sample—open `client.realtime.stt.connect`, call `session.send_byte_chunk` or `session.send_bytes`, then iterate `session.receive_events()` to render tokens. example:
70
71
 
71
72
  ```python
72
73
  from soniox import SonioxClient
@@ -76,7 +77,7 @@ from soniox.utils import render_tokens, throttle_audio, start_audio_thread
76
77
  DEMO_FILE = "path_to_your_audio_file"
77
78
 
78
79
  client = SonioxClient()
79
- config = RealtimeSTTConfig(model="stt-rt-v3", audio_format="mp3")
80
+ config = RealtimeSTTConfig(model="stt-rt-v4", audio_format="mp3")
80
81
  final_tokens: list[Token] = []
81
82
  non_final_tokens: list[Token] = []
82
83
 
@@ -99,9 +100,9 @@ see [`examples/soniox_client/realtime_example.py`](https://github.com/soniox/son
99
100
 
100
101
  ## Repository layout
101
102
 
102
- - `src/soniox/` – sdk code (clients, http namespaces, realtime/session helpers, types, utils).
103
- - `examples/soniox_client` & `examples/async_soniox_client` – runnable rest + realtime flows for sync and async.
104
- - `docs/` – folder where `pydoc-markdown` command generates full sdk reference markdown file.
103
+ - `src/soniox/` – sdk code (clients, http namespaces, real-time/session helpers, types, utils).
104
+ - `examples/soniox_client` & `examples/async_soniox_client` – runnable rest + real-time flows for sync and async.
105
+ - `docs/` – markdown outputs (e.g., `docs/python-sdk.md`) that come from `pydoc-markdown`.
105
106
  - `assets/` – sample audio referenced by the examples.
106
107
  - `tests/` – pytest narratives that describe the public behavior.
107
108
 
@@ -111,11 +112,20 @@ see [`examples/soniox_client/realtime_example.py`](https://github.com/soniox/son
111
112
  uv install --with dev
112
113
  ```
113
114
 
114
- This pulls in `ruff`, `pyright`, `pytest`, `pydoc-markdown`, etc., so you can lint, type-check, test, and regenerate docs locally.
115
+ This pulls in `ruff`, `pyright`, `pytest`, etc., so you can lint, type-check, test, and regenerate docs locally.
116
+
117
+ ## Docs
118
+
119
+ ```bash
120
+ source .venv/bin/activate
121
+ python3 scripts/generate_docs.py
122
+ ```
123
+
124
+ Docs are output to `/docs` directory.
115
125
 
116
126
  ## Resources
117
127
 
118
- - [soniox.com/docs](https://soniox.com/docs) – official Soniox documentation.
128
+ - [soniox.com/docs](https://soniox.com/docs/stt/SDKs/python-SDK) – official Soniox documentation.
119
129
  - [GitHub repo](https://github.com/soniox/soniox-python) – source, examples, and scripts.
120
130
  - [PyPI](https://pypi.org/project/soniox/)
121
131
  - Support: `support@soniox.com`.
@@ -1,6 +1,7 @@
1
1
  # Soniox Python SDK
2
2
 
3
- The SDK exposes two clients: `SonioxClient` (sync) and `AsyncSonioxClient`. Client can hit every Soniox REST endpoint or open a realtime websocket session without wiring headers, retries, or payload validation yourself. Auth, file uploads, transcription polling, webhook helpers, and realtime stream helpers all live in one typed package.
3
+ The SDK exposes two clients: `SonioxClient` (sync) and `AsyncSonioxClient`. Client can hit every Soniox REST endpoint or open a real-time websocket session, so you can focus on building features instead of dealing with boilerplate.
4
+ Auth, file uploads, transcription polling, webhook helpers, and real-time stream helpers all live in one typed package.
4
5
 
5
6
  ## Install
6
7
 
@@ -13,7 +14,7 @@ export SONIOX_API_KEY=<your-key>
13
14
 
14
15
  Get your API key from the [Soniox Console](https://console.soniox.com) and inject it once per shell session. Both clients read `SONIOX_API_KEY` by default, but you can override it per-client if needed.
15
16
 
16
- ## Quick run (rest + realtime)
17
+ ## Quick run (rest + real-time)
17
18
 
18
19
  1. **REST transcription**: copy this snippet or run [`examples/soniox_client/api_example.py`](https://github.com/soniox/soniox-python/blob/main/examples/soniox_client/api_example.py).
19
20
 
@@ -21,15 +22,15 @@ Get your API key from the [Soniox Console](https://console.soniox.com) and injec
21
22
  from soniox import SonioxClient
22
23
 
23
24
  client = SonioxClient()
24
- transcription = client.transcriptions.transcribe(
25
+ transcription = client.stt.transcribe(
25
26
  audio_url="https://soniox.com/media/examples/coffee_shop.mp3",
26
27
  client_reference_id="docs-quick-start",
27
28
  )
28
- client.transcriptions.wait(transcription.id, timeout_sec=60)
29
- print(client.transcriptions.get_transcript(transcription.id).text[:200])
29
+ client.stt.wait(transcription.id, timeout_sec=60)
30
+ print(client.stt.get_transcript(transcription.id).text[:200])
30
31
  ```
31
32
 
32
- 2. **Realtime streaming**: the realtime helpers mirror the sync rest sample—open `client.realtime.stt.connect`, call `session.send_byte_chunk` or `session.send_bytes`, then iterate `session.receive_events()` to render tokens. example:
33
+ 2. **Real-time streaming**: the real-time helpers mirror the sync rest sample—open `client.realtime.stt.connect`, call `session.send_byte_chunk` or `session.send_bytes`, then iterate `session.receive_events()` to render tokens. example:
33
34
 
34
35
  ```python
35
36
  from soniox import SonioxClient
@@ -39,7 +40,7 @@ from soniox.utils import render_tokens, throttle_audio, start_audio_thread
39
40
  DEMO_FILE = "path_to_your_audio_file"
40
41
 
41
42
  client = SonioxClient()
42
- config = RealtimeSTTConfig(model="stt-rt-v3", audio_format="mp3")
43
+ config = RealtimeSTTConfig(model="stt-rt-v4", audio_format="mp3")
43
44
  final_tokens: list[Token] = []
44
45
  non_final_tokens: list[Token] = []
45
46
 
@@ -62,9 +63,9 @@ see [`examples/soniox_client/realtime_example.py`](https://github.com/soniox/son
62
63
 
63
64
  ## Repository layout
64
65
 
65
- - `src/soniox/` – sdk code (clients, http namespaces, realtime/session helpers, types, utils).
66
- - `examples/soniox_client` & `examples/async_soniox_client` – runnable rest + realtime flows for sync and async.
67
- - `docs/` – folder where `pydoc-markdown` command generates full sdk reference markdown file.
66
+ - `src/soniox/` – sdk code (clients, http namespaces, real-time/session helpers, types, utils).
67
+ - `examples/soniox_client` & `examples/async_soniox_client` – runnable rest + real-time flows for sync and async.
68
+ - `docs/` – markdown outputs (e.g., `docs/python-sdk.md`) that come from `pydoc-markdown`.
68
69
  - `assets/` – sample audio referenced by the examples.
69
70
  - `tests/` – pytest narratives that describe the public behavior.
70
71
 
@@ -74,11 +75,20 @@ see [`examples/soniox_client/realtime_example.py`](https://github.com/soniox/son
74
75
  uv install --with dev
75
76
  ```
76
77
 
77
- This pulls in `ruff`, `pyright`, `pytest`, `pydoc-markdown`, etc., so you can lint, type-check, test, and regenerate docs locally.
78
+ This pulls in `ruff`, `pyright`, `pytest`, etc., so you can lint, type-check, test, and regenerate docs locally.
79
+
80
+ ## Docs
81
+
82
+ ```bash
83
+ source .venv/bin/activate
84
+ python3 scripts/generate_docs.py
85
+ ```
86
+
87
+ Docs are output to `/docs` directory.
78
88
 
79
89
  ## Resources
80
90
 
81
- - [soniox.com/docs](https://soniox.com/docs) – official Soniox documentation.
91
+ - [soniox.com/docs](https://soniox.com/docs/stt/SDKs/python-SDK) – official Soniox documentation.
82
92
  - [GitHub repo](https://github.com/soniox/soniox-python) – source, examples, and scripts.
83
93
  - [PyPI](https://pypi.org/project/soniox/)
84
94
  - Support: `support@soniox.com`.