vocalstack 1.0.0a15__tar.gz → 1.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.
- {vocalstack-1.0.0a15 → vocalstack-1.2.0}/PKG-INFO +70 -2
- {vocalstack-1.0.0a15 → vocalstack-1.2.0}/README.md +69 -1
- {vocalstack-1.0.0a15 → vocalstack-1.2.0}/SKILL.md +3 -2
- {vocalstack-1.0.0a15 → vocalstack-1.2.0}/pyproject.toml +1 -1
- {vocalstack-1.0.0a15 → vocalstack-1.2.0}/skills/vocalstack/SKILL.md +3 -2
- {vocalstack-1.0.0a15 → vocalstack-1.2.0}/src/vocalstack/__init__.py +1 -1
- {vocalstack-1.0.0a15 → vocalstack-1.2.0}/src/vocalstack/_models.py +87 -47
- vocalstack-1.2.0/src/vocalstack/realtime.py +1478 -0
- {vocalstack-1.0.0a15 → vocalstack-1.2.0}/src/vocalstack/resources.py +27 -10
- vocalstack-1.0.0a15/src/vocalstack/realtime.py +0 -555
- {vocalstack-1.0.0a15 → vocalstack-1.2.0}/.gitignore +0 -0
- {vocalstack-1.0.0a15 → vocalstack-1.2.0}/LICENSE +0 -0
- {vocalstack-1.0.0a15 → vocalstack-1.2.0}/src/vocalstack/_http.py +0 -0
- {vocalstack-1.0.0a15 → vocalstack-1.2.0}/src/vocalstack/client.py +0 -0
- {vocalstack-1.0.0a15 → vocalstack-1.2.0}/src/vocalstack/errors.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: vocalstack
|
|
3
|
-
Version: 1.0
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: VocalStack speech API SDK (asyncio): one client grouped by resource, typed models from the API contract, realtime WebSocket streaming.
|
|
5
5
|
Project-URL: Homepage, https://vocalstack.com
|
|
6
6
|
License-Expression: MIT
|
|
@@ -112,7 +112,75 @@ async with VocalStack(api_key=key) as vs:
|
|
|
112
112
|
- `transcript.draft` frames **fully replace** the live tail; never append them.
|
|
113
113
|
- `transcript.committed` segments are immutable, gapless by `segment.seq`,
|
|
114
114
|
and carry word timings.
|
|
115
|
-
- A dropped connection ends the
|
|
115
|
+
- A dropped connection ends the realtime session (to go on, create a new one), except after a restart close (1012) or when the server it was on died: the SDK then reconnects to the same `streamUrl` and the realtime session goes on. A restart close that comes before `session.ready` is followed the same way inside `connect` (about 1, 2 and 4 s apart, three more tries at most), so it is not an error of the first connect.
|
|
116
|
+
- After a restart close (1012, a server being replaced), when the server says
|
|
117
|
+
how many bytes it took (`taken=`, said only for `input.kind` `live`), the SDK
|
|
118
|
+
sends the audio after that byte again. For this a session keeps
|
|
119
|
+
the last 30 seconds of audio sent, about 1.9 MB at 16 kHz mono.
|
|
120
|
+
`resend_buffer_s` (or `resend_buffer_bytes`) on `connect` and `publish`
|
|
121
|
+
changes the size, `0` keeps nothing, and `on_audio_lost(bytes)` is called
|
|
122
|
+
when some audio could not be sent again. A file given to `send_file` or
|
|
123
|
+
`transcribe_file` is not kept: on a live session it is read again from the
|
|
124
|
+
byte the server named; on a file session (`input.kind` `file`), where the
|
|
125
|
+
server names no byte and keeps nothing of an upload it did not finish, it is
|
|
126
|
+
sent again from its first byte. So give a path or bytes rather than a source
|
|
127
|
+
that can be read only once (a FIFO, a device: with one a reconnect ends the
|
|
128
|
+
file session with `engine_lost`). The session
|
|
129
|
+
does the reconnecting in a task of its own as soon as the close is seen, so
|
|
130
|
+
a caller that only sends audio and iterates later is carried on as well;
|
|
131
|
+
the frames read meanwhile are kept for the iterator.
|
|
132
|
+
`publish` sizes the buffer for the publisher's format, 16 kHz mono f32le
|
|
133
|
+
(64,000 bytes a second).
|
|
134
|
+
- When the session could not be carried on (the reconnect was refused for
|
|
135
|
+
good, or its tries ran out) it ends with an error. A caller that only sends
|
|
136
|
+
learns of it without iterating: `on_audio_lost` is called with the bytes
|
|
137
|
+
that were waiting for the next socket and then with the size of every
|
|
138
|
+
`send_audio` made after the end; iterating the session raises the error.
|
|
139
|
+
`send_audio` itself never raises it.
|
|
140
|
+
- A file or link session's socket URL says `refile=1` when the client can
|
|
141
|
+
start over: for a file, that it can be read and sent again; for a link, that
|
|
142
|
+
whoever collects the lines drops them when the run starts again. Only then
|
|
143
|
+
does the server, when its machine stops or its engine is lost mid-way, drop
|
|
144
|
+
the socket and transcribe again from the start on the next one; without
|
|
145
|
+
`refile` such a session ends with a retryable `engine_lost` (create a new
|
|
146
|
+
session). `transcribe_file` says it by itself for a source it can read again and
|
|
147
|
+
`transcribe_url` always does; with `connect`, pass `refile=True` when you send a file
|
|
148
|
+
you can read again with `send_file`, or collect a link's lines yourself and
|
|
149
|
+
start them over. When a run starts again the transcript starts over:
|
|
150
|
+
`seq` and `sentenceId` begin at 0 again, times are those of the new run, and
|
|
151
|
+
`on_commit` and the session's events deliver the lines again from the first.
|
|
152
|
+
`transcribe_file` and `transcribe_url` return the last run alone.
|
|
153
|
+
- The first connect follows an upgrade answered 503 with `Retry-After` (a
|
|
154
|
+
server that is stopping while another has a place): it waits that long, 30
|
|
155
|
+
seconds at most, and opens the same `streamUrl` again, three more tries at
|
|
156
|
+
most, the same tries a restart close before `session.ready` gets. A 503
|
|
157
|
+
without `Retry-After` is the connect's error, as before.
|
|
158
|
+
- `send_file` returns when `eof` is written or waits for the next socket, and
|
|
159
|
+
also when the session ended first: closed by you, ended by the server, or
|
|
160
|
+
failed. How a session ended comes once, from the iterator, which raises the
|
|
161
|
+
session's error (also a file that changed or could not be read again after a
|
|
162
|
+
restart). `send_file` raises only what reading the source raises on its first
|
|
163
|
+
pass (`OSError`: no such file), and the session is then closed. So
|
|
164
|
+
`asyncio.create_task(session.send_file(path))` beside an `async for` loop is
|
|
165
|
+
safe.
|
|
166
|
+
- Every connect of a session that keeps audio adds `resend=<ms>` to the stream
|
|
167
|
+
URL's query, the length of its buffer in milliseconds (`resend=30000` by
|
|
168
|
+
default), so the server knows this client sends again after a restart and
|
|
169
|
+
how far back; a session with the buffer set to `0` does not. With a buffer
|
|
170
|
+
under 22 seconds the server keeps the old behaviour on a restart.
|
|
171
|
+
- A reconnect the server answers with 503 "try again" is tried for up to about
|
|
172
|
+
95 seconds before the session ends with `engine_lost` (it was about 7
|
|
173
|
+
seconds: three tries). To stop sooner, `close()` the session yourself, or
|
|
174
|
+
lower `vocalstack.realtime.REFUSED_TOTAL_S` (90 by default).
|
|
175
|
+
- A 503 that carries `Retry-After` is tried again after exactly that long
|
|
176
|
+
(spread upward only, by 30% at most), not after the longer of it and the
|
|
177
|
+
session's own 1, 2, 4, 8, 15 s waits, and does not move those waits on; a
|
|
178
|
+
503 without it keeps them. The 90 seconds in all are the same.
|
|
179
|
+
- A connect that fails before the server answers raises `VocalStackError`
|
|
180
|
+
`engine_unavailable`, on the first connect too (the library's own exception
|
|
181
|
+
is its `__cause__`); a stream URL that is not one is not retryable.
|
|
182
|
+
- Cancelling the task that iterates a session while it reconnects closes the
|
|
183
|
+
session.
|
|
116
184
|
|
|
117
185
|
## Errors
|
|
118
186
|
|
|
@@ -99,7 +99,75 @@ async with VocalStack(api_key=key) as vs:
|
|
|
99
99
|
- `transcript.draft` frames **fully replace** the live tail; never append them.
|
|
100
100
|
- `transcript.committed` segments are immutable, gapless by `segment.seq`,
|
|
101
101
|
and carry word timings.
|
|
102
|
-
- A dropped connection ends the
|
|
102
|
+
- A dropped connection ends the realtime session (to go on, create a new one), except after a restart close (1012) or when the server it was on died: the SDK then reconnects to the same `streamUrl` and the realtime session goes on. A restart close that comes before `session.ready` is followed the same way inside `connect` (about 1, 2 and 4 s apart, three more tries at most), so it is not an error of the first connect.
|
|
103
|
+
- After a restart close (1012, a server being replaced), when the server says
|
|
104
|
+
how many bytes it took (`taken=`, said only for `input.kind` `live`), the SDK
|
|
105
|
+
sends the audio after that byte again. For this a session keeps
|
|
106
|
+
the last 30 seconds of audio sent, about 1.9 MB at 16 kHz mono.
|
|
107
|
+
`resend_buffer_s` (or `resend_buffer_bytes`) on `connect` and `publish`
|
|
108
|
+
changes the size, `0` keeps nothing, and `on_audio_lost(bytes)` is called
|
|
109
|
+
when some audio could not be sent again. A file given to `send_file` or
|
|
110
|
+
`transcribe_file` is not kept: on a live session it is read again from the
|
|
111
|
+
byte the server named; on a file session (`input.kind` `file`), where the
|
|
112
|
+
server names no byte and keeps nothing of an upload it did not finish, it is
|
|
113
|
+
sent again from its first byte. So give a path or bytes rather than a source
|
|
114
|
+
that can be read only once (a FIFO, a device: with one a reconnect ends the
|
|
115
|
+
file session with `engine_lost`). The session
|
|
116
|
+
does the reconnecting in a task of its own as soon as the close is seen, so
|
|
117
|
+
a caller that only sends audio and iterates later is carried on as well;
|
|
118
|
+
the frames read meanwhile are kept for the iterator.
|
|
119
|
+
`publish` sizes the buffer for the publisher's format, 16 kHz mono f32le
|
|
120
|
+
(64,000 bytes a second).
|
|
121
|
+
- When the session could not be carried on (the reconnect was refused for
|
|
122
|
+
good, or its tries ran out) it ends with an error. A caller that only sends
|
|
123
|
+
learns of it without iterating: `on_audio_lost` is called with the bytes
|
|
124
|
+
that were waiting for the next socket and then with the size of every
|
|
125
|
+
`send_audio` made after the end; iterating the session raises the error.
|
|
126
|
+
`send_audio` itself never raises it.
|
|
127
|
+
- A file or link session's socket URL says `refile=1` when the client can
|
|
128
|
+
start over: for a file, that it can be read and sent again; for a link, that
|
|
129
|
+
whoever collects the lines drops them when the run starts again. Only then
|
|
130
|
+
does the server, when its machine stops or its engine is lost mid-way, drop
|
|
131
|
+
the socket and transcribe again from the start on the next one; without
|
|
132
|
+
`refile` such a session ends with a retryable `engine_lost` (create a new
|
|
133
|
+
session). `transcribe_file` says it by itself for a source it can read again and
|
|
134
|
+
`transcribe_url` always does; with `connect`, pass `refile=True` when you send a file
|
|
135
|
+
you can read again with `send_file`, or collect a link's lines yourself and
|
|
136
|
+
start them over. When a run starts again the transcript starts over:
|
|
137
|
+
`seq` and `sentenceId` begin at 0 again, times are those of the new run, and
|
|
138
|
+
`on_commit` and the session's events deliver the lines again from the first.
|
|
139
|
+
`transcribe_file` and `transcribe_url` return the last run alone.
|
|
140
|
+
- The first connect follows an upgrade answered 503 with `Retry-After` (a
|
|
141
|
+
server that is stopping while another has a place): it waits that long, 30
|
|
142
|
+
seconds at most, and opens the same `streamUrl` again, three more tries at
|
|
143
|
+
most, the same tries a restart close before `session.ready` gets. A 503
|
|
144
|
+
without `Retry-After` is the connect's error, as before.
|
|
145
|
+
- `send_file` returns when `eof` is written or waits for the next socket, and
|
|
146
|
+
also when the session ended first: closed by you, ended by the server, or
|
|
147
|
+
failed. How a session ended comes once, from the iterator, which raises the
|
|
148
|
+
session's error (also a file that changed or could not be read again after a
|
|
149
|
+
restart). `send_file` raises only what reading the source raises on its first
|
|
150
|
+
pass (`OSError`: no such file), and the session is then closed. So
|
|
151
|
+
`asyncio.create_task(session.send_file(path))` beside an `async for` loop is
|
|
152
|
+
safe.
|
|
153
|
+
- Every connect of a session that keeps audio adds `resend=<ms>` to the stream
|
|
154
|
+
URL's query, the length of its buffer in milliseconds (`resend=30000` by
|
|
155
|
+
default), so the server knows this client sends again after a restart and
|
|
156
|
+
how far back; a session with the buffer set to `0` does not. With a buffer
|
|
157
|
+
under 22 seconds the server keeps the old behaviour on a restart.
|
|
158
|
+
- A reconnect the server answers with 503 "try again" is tried for up to about
|
|
159
|
+
95 seconds before the session ends with `engine_lost` (it was about 7
|
|
160
|
+
seconds: three tries). To stop sooner, `close()` the session yourself, or
|
|
161
|
+
lower `vocalstack.realtime.REFUSED_TOTAL_S` (90 by default).
|
|
162
|
+
- A 503 that carries `Retry-After` is tried again after exactly that long
|
|
163
|
+
(spread upward only, by 30% at most), not after the longer of it and the
|
|
164
|
+
session's own 1, 2, 4, 8, 15 s waits, and does not move those waits on; a
|
|
165
|
+
503 without it keeps them. The 90 seconds in all are the same.
|
|
166
|
+
- A connect that fails before the server answers raises `VocalStackError`
|
|
167
|
+
`engine_unavailable`, on the first connect too (the library's own exception
|
|
168
|
+
is its `__cause__`); a stream URL that is not one is not retryable.
|
|
169
|
+
- Cancelling the task that iterates a session while it reconnects closes the
|
|
170
|
+
session.
|
|
103
171
|
|
|
104
172
|
## Errors
|
|
105
173
|
|
|
@@ -45,8 +45,9 @@ for that transcription, so print the text without a speaker.
|
|
|
45
45
|
real usage on the account's tier and quotas.
|
|
46
46
|
- Keys are for servers. Never put a key in browser code or in a URL. The API
|
|
47
47
|
refuses a key sent from a web page (`Origin` header) or in a query string.
|
|
48
|
-
- Scopes: `read` (read transcripts, search, export), `write`
|
|
49
|
-
|
|
48
|
+
- Scopes: `read` (read transcripts, search, export), `write` (transcribe
|
|
49
|
+
files and links, open realtime sessions, change things), `recordings:publish`
|
|
50
|
+
(start, pause and stop a stored live transcription and send it audio), or `*`.
|
|
50
51
|
- Base URL: `https://api.vocalstack.com` (the default). Override it with
|
|
51
52
|
`VOCALSTACK_BASE_URL` (for example, a local or staging server).
|
|
52
53
|
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "vocalstack"
|
|
7
|
-
version = "1.0
|
|
7
|
+
version = "1.2.0"
|
|
8
8
|
description = "VocalStack speech API SDK (asyncio): one client grouped by resource, typed models from the API contract, realtime WebSocket streaming."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
@@ -45,8 +45,9 @@ for that transcription, so print the text without a speaker.
|
|
|
45
45
|
real usage on the account's tier and quotas.
|
|
46
46
|
- Keys are for servers. Never put a key in browser code or in a URL. The API
|
|
47
47
|
refuses a key sent from a web page (`Origin` header) or in a query string.
|
|
48
|
-
- Scopes: `read` (read transcripts, search, export), `write`
|
|
49
|
-
|
|
48
|
+
- Scopes: `read` (read transcripts, search, export), `write` (transcribe
|
|
49
|
+
files and links, open realtime sessions, change things), `recordings:publish`
|
|
50
|
+
(start, pause and stop a stored live transcription and send it audio), or `*`.
|
|
50
51
|
- Base URL: `https://api.vocalstack.com` (the default). Override it with
|
|
51
52
|
`VOCALSTACK_BASE_URL` (for example, a local or staging server).
|
|
52
53
|
|
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
4
|
import json
|
|
5
|
+
import logging
|
|
5
6
|
from typing import Annotated, Any, Dict, List, Literal, Optional, Union
|
|
6
7
|
|
|
7
|
-
from pydantic import BaseModel, ConfigDict, Field, TypeAdapter
|
|
8
|
+
from pydantic import BaseModel, ConfigDict, Field, TypeAdapter, ValidationError
|
|
9
|
+
|
|
10
|
+
_log = logging.getLogger("vocalstack")
|
|
8
11
|
|
|
9
12
|
|
|
10
13
|
class _Base(BaseModel):
|
|
@@ -12,75 +15,75 @@ class _Base(BaseModel):
|
|
|
12
15
|
model_config = ConfigDict(populate_by_name=True, extra="ignore")
|
|
13
16
|
|
|
14
17
|
|
|
15
|
-
Access = Literal["public", "private"]
|
|
18
|
+
Access = Union[Literal["public", "private"], str]
|
|
16
19
|
|
|
17
|
-
ErrorCode = Literal["invalid_audio", "invalid_options", "invalid_token", "capacity_exceeded", "slow_consumer", "engine_unavailable", "internal", "session_expired", "engine_lost", "forbidden", "broadcast_archived", "not_found", "conflict", "invalid_state", "password_required", "rate_limited", "preview_pending", "language_unavailable", "suspended", "key_expired", "key_revoked", "key_from_browser", "insufficient_credit", "usage_cap_reached", "payment_method_required", "terms_acceptance_required", "payment_method_in_use", "billing_details_required", "promo_code_invalid", "auto_top_up_off", "range_too_long", "quota_exceeded", "idempotency_key_reused", "method_not_allowed", "payload_too_large", "unsupported_media_type", "invalid_body", "timeout", "language_limit_reached", "unavailable"]
|
|
20
|
+
ErrorCode = Union[Literal["invalid_audio", "invalid_options", "invalid_token", "capacity_exceeded", "slow_consumer", "engine_unavailable", "internal", "session_expired", "engine_lost", "forbidden", "broadcast_archived", "not_found", "conflict", "invalid_state", "password_required", "rate_limited", "preview_pending", "language_unavailable", "suspended", "key_expired", "key_revoked", "key_from_browser", "insufficient_credit", "usage_cap_reached", "payment_method_required", "terms_acceptance_required", "payment_method_in_use", "billing_details_required", "promo_code_invalid", "auto_top_up_off", "range_too_long", "quota_exceeded", "idempotency_key_reused", "method_not_allowed", "payload_too_large", "unsupported_media_type", "invalid_body", "timeout", "language_limit_reached", "unavailable"], str]
|
|
18
21
|
|
|
19
|
-
SampleWarning = Literal["overlaps", "noisy", "weak_voice", "unclear", "cut_off"]
|
|
22
|
+
SampleWarning = Union[Literal["overlaps", "noisy", "weak_voice", "unclear", "cut_off"], str]
|
|
20
23
|
|
|
21
|
-
AudioEncoding = Literal["pcm_f32le"]
|
|
24
|
+
AudioEncoding = Union[Literal["pcm_f32le"], str]
|
|
22
25
|
|
|
23
|
-
FixKind = Literal["extension", "scheme", "page_stream"]
|
|
26
|
+
FixKind = Union[Literal["extension", "scheme", "page_stream"], str]
|
|
24
27
|
|
|
25
|
-
SourceProblem = Literal["not_found", "refused", "server_error", "unknown_host", "unreachable", "private_address", "timeout", "web_page", "bad_playlist", "not_audio", "unsupported", "youtube_upcoming", "youtube_not_live", "youtube_unavailable", "youtube_busy"]
|
|
28
|
+
SourceProblem = Union[Literal["not_found", "refused", "server_error", "unknown_host", "unreachable", "private_address", "timeout", "web_page", "bad_playlist", "not_audio", "unsupported", "youtube_upcoming", "youtube_not_live", "youtube_unavailable", "youtube_busy"], str]
|
|
26
29
|
|
|
27
|
-
AudioSourceState = Literal["ready", "error"]
|
|
30
|
+
AudioSourceState = Union[Literal["ready", "error"], str]
|
|
28
31
|
|
|
29
|
-
TranscriptionState = Literal["idle", "pending", "live", "paused", "processing", "ended", "finalized"]
|
|
32
|
+
TranscriptionState = Union[Literal["idle", "pending", "live", "paused", "processing", "ended", "finalized"], str]
|
|
30
33
|
|
|
31
|
-
Lifecycle = Literal["active", "archived", "purged"]
|
|
34
|
+
Lifecycle = Union[Literal["active", "archived", "purged"], str]
|
|
32
35
|
|
|
33
|
-
LatencyMode = Literal["auto", "fast", "accuracy"]
|
|
36
|
+
LatencyMode = Union[Literal["auto", "fast", "accuracy"], str]
|
|
34
37
|
|
|
35
|
-
SpeakerLabels = Literal["auto", "on", "off"]
|
|
38
|
+
SpeakerLabels = Union[Literal["auto", "on", "off"], str]
|
|
36
39
|
|
|
37
|
-
ClientApp = Literal["mac_app"]
|
|
40
|
+
ClientApp = Union[Literal["mac_app"], str]
|
|
38
41
|
|
|
39
|
-
ClientKind = Literal["dashboard", "chrome_extension", "mac_app", "obs_plugin", "sdk", "other"]
|
|
42
|
+
ClientKind = Union[Literal["dashboard", "chrome_extension", "mac_app", "obs_plugin", "sdk", "other"], str]
|
|
40
43
|
|
|
41
|
-
Decoder = Literal["fast", "accuracy"]
|
|
44
|
+
Decoder = Union[Literal["fast", "accuracy"], str]
|
|
42
45
|
|
|
43
|
-
Consent = Literal["pending", "granted", "refused"]
|
|
46
|
+
Consent = Union[Literal["pending", "granted", "refused"], str]
|
|
44
47
|
|
|
45
|
-
NotVoicedReason = Literal["rewrite"]
|
|
48
|
+
NotVoicedReason = Union[Literal["rewrite"], str]
|
|
46
49
|
|
|
47
|
-
DoneReason = Literal["eof", "max_duration", "cancelled"]
|
|
50
|
+
DoneReason = Union[Literal["eof", "max_duration", "cancelled"], str]
|
|
48
51
|
|
|
49
|
-
ExportFormat = Literal["json", "srt", "vtt", "txt", "md", "xlsx", "pdf"]
|
|
52
|
+
ExportFormat = Union[Literal["json", "srt", "vtt", "txt", "md", "xlsx", "pdf"], str]
|
|
50
53
|
|
|
51
|
-
ExportTimestamps = Literal["off", "paragraph", "line"]
|
|
54
|
+
ExportTimestamps = Union[Literal["off", "paragraph", "line"], str]
|
|
52
55
|
|
|
53
|
-
FileUploadState = Literal["uploading", "complete"]
|
|
56
|
+
FileUploadState = Union[Literal["uploading", "complete"], str]
|
|
54
57
|
|
|
55
|
-
HealthStatus = Literal["ok"]
|
|
58
|
+
HealthStatus = Union[Literal["ok"], str]
|
|
56
59
|
|
|
57
|
-
IngestState = Literal["connecting", "streaming", "reconnecting", "stopped", "failed"]
|
|
60
|
+
IngestState = Union[Literal["connecting", "streaming", "reconnecting", "stopped", "failed"], str]
|
|
58
61
|
|
|
59
|
-
InputKind = Literal["live", "file", "url", "stream"]
|
|
62
|
+
InputKind = Union[Literal["live", "file", "url", "stream"], str]
|
|
60
63
|
|
|
61
|
-
InviteState = Literal["pending", "expired"]
|
|
64
|
+
InviteState = Union[Literal["pending", "expired"], str]
|
|
62
65
|
|
|
63
|
-
QueueReason = Literal["concurrency"]
|
|
66
|
+
QueueReason = Union[Literal["concurrency"], str]
|
|
64
67
|
|
|
65
|
-
JobState = Literal["queued", "fetching", "transcribing", "done", "failed", "cropping", "stopped"]
|
|
68
|
+
JobState = Union[Literal["queued", "fetching", "transcribing", "done", "failed", "cropping", "stopped"], str]
|
|
66
69
|
|
|
67
|
-
LanguageStatusState = Literal["matches", "mismatch", "unknown", "change_unsupported"]
|
|
70
|
+
LanguageStatusState = Union[Literal["matches", "mismatch", "unknown", "change_unsupported"], str]
|
|
68
71
|
|
|
69
|
-
LinkKind = Literal["live", "file", "unknown"]
|
|
72
|
+
LinkKind = Union[Literal["live", "file", "unknown"], str]
|
|
70
73
|
|
|
71
|
-
ProbeReason = Literal["web_page", "site_not_fetched", "meeting", "not_found", "unreachable", "forbidden", "not_media", "copy_protected", "too_long", "unknown"]
|
|
74
|
+
ProbeReason = Union[Literal["web_page", "site_not_fetched", "meeting", "not_found", "unreachable", "forbidden", "not_media", "copy_protected", "too_long", "empty", "unknown"], str]
|
|
72
75
|
|
|
73
|
-
LoadingStage = Literal["download", "model"]
|
|
76
|
+
LoadingStage = Union[Literal["download", "model"], str]
|
|
74
77
|
|
|
75
|
-
SourceKind = Literal["file", "url"]
|
|
78
|
+
SourceKind = Union[Literal["file", "url"], str]
|
|
76
79
|
|
|
77
|
-
PullState = Literal["connecting", "streaming", "reconnecting", "failed"]
|
|
80
|
+
PullState = Union[Literal["connecting", "streaming", "reconnecting", "failed"], str]
|
|
78
81
|
|
|
79
|
-
RecordingState = Literal["pending", "live", "paused", "processing", "ended", "finalized"]
|
|
82
|
+
RecordingState = Union[Literal["pending", "live", "paused", "processing", "ended", "finalized"], str]
|
|
80
83
|
|
|
81
|
-
SentenceStatus = Literal["open", "closed", "dropped"]
|
|
84
|
+
SentenceStatus = Union[Literal["open", "closed", "dropped"], str]
|
|
82
85
|
|
|
83
|
-
VoiceStatusState = Literal["preparing", "unavailable"]
|
|
86
|
+
VoiceStatusState = Union[Literal["preparing", "unavailable"], str]
|
|
84
87
|
|
|
85
88
|
|
|
86
89
|
class AccountClosing(_Base):
|
|
@@ -124,7 +127,7 @@ class AmendTail(_Base):
|
|
|
124
127
|
|
|
125
128
|
|
|
126
129
|
class ErrorData(_Base):
|
|
127
|
-
details: Optional[Any] = None
|
|
130
|
+
details: Optional[Dict[str, Any]] = None
|
|
128
131
|
retryable: bool
|
|
129
132
|
|
|
130
133
|
|
|
@@ -411,6 +414,22 @@ class PlanRef(_Base):
|
|
|
411
414
|
name: str
|
|
412
415
|
|
|
413
416
|
|
|
417
|
+
class StorePrice(_Base):
|
|
418
|
+
"""A price paid at an app store."""
|
|
419
|
+
|
|
420
|
+
amount: float
|
|
421
|
+
currency: str
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
class StorePurchases(_Base):
|
|
425
|
+
"""Credit packs bought in an app store."""
|
|
426
|
+
|
|
427
|
+
count: int
|
|
428
|
+
credit: float
|
|
429
|
+
paid: List["StorePrice"]
|
|
430
|
+
store: str
|
|
431
|
+
|
|
432
|
+
|
|
414
433
|
class NextPayment(_Base):
|
|
415
434
|
amount: float
|
|
416
435
|
at: str
|
|
@@ -447,6 +466,7 @@ class SubscriptionView(_Base):
|
|
|
447
466
|
return_plan: Optional[str] = Field(default=None, alias="returnPlan")
|
|
448
467
|
scheduled_end: Optional["ScheduledEnd"] = Field(default=None, alias="scheduledEnd")
|
|
449
468
|
status: str
|
|
469
|
+
store: str
|
|
450
470
|
switch_prices: "SwitchPrices" = Field(alias="switchPrices")
|
|
451
471
|
yearly_opt_in: bool = Field(alias="yearlyOptIn")
|
|
452
472
|
|
|
@@ -482,6 +502,7 @@ running transcriptions go on below zero, never how far."""
|
|
|
482
502
|
retention_deadline: Optional[str] = Field(default=None, alias="retentionDeadline")
|
|
483
503
|
start_block: Optional[str] = Field(default=None, alias="startBlock")
|
|
484
504
|
start_block_live: Optional[str] = Field(default=None, alias="startBlockLive")
|
|
505
|
+
store_purchases: Optional["StorePurchases"] = Field(default=None, alias="storePurchases")
|
|
485
506
|
subscription: Optional["SubscriptionView"] = None
|
|
486
507
|
top_up_url: str = Field(alias="topUpUrl")
|
|
487
508
|
|
|
@@ -518,6 +539,7 @@ class ConfidencePolicy(_Base):
|
|
|
518
539
|
|
|
519
540
|
hide_below: Optional[float] = Field(default=None, alias="hideBelow")
|
|
520
541
|
low_threshold: Optional[float] = Field(default=None, alias="lowThreshold")
|
|
542
|
+
# This many low-confidence words suppress a line for listeners.
|
|
521
543
|
suppress_count: Optional[int] = Field(default=None, alias="suppressCount")
|
|
522
544
|
|
|
523
545
|
|
|
@@ -536,6 +558,7 @@ design's settings sheet): what a recording made in it starts with."""
|
|
|
536
558
|
summary_translations: Optional[bool] = Field(default=None, alias="summaryTranslations")
|
|
537
559
|
title: Optional[bool] = None
|
|
538
560
|
translation_tts: Optional[bool] = Field(default=None, alias="translationTts")
|
|
561
|
+
# Accepted for compatibility and ignored: VocalStack picks the voice that reads each speaker, and the only choice is whether cloned voices are used (`voiceCloning`).
|
|
539
562
|
voice_by_lang: Optional[Dict[str, str]] = Field(default=None, alias="voiceByLang")
|
|
540
563
|
voice_cloning: Optional[bool] = Field(default=None, alias="voiceCloning")
|
|
541
564
|
voice_cloning_consent: Optional[bool] = Field(default=None, alias="voiceCloningConsent")
|
|
@@ -714,6 +737,7 @@ Its id is the speaker's, so `clone:<id>` names it as a voice."""
|
|
|
714
737
|
|
|
715
738
|
|
|
716
739
|
class CommittedSegment(_Base):
|
|
740
|
+
# `true` when the segment was decoded by the fast model: the `auto` transcription method catching up after falling behind real time, or the `fast` method.
|
|
717
741
|
catchup: Optional[bool] = None
|
|
718
742
|
confidence: Optional[float] = None
|
|
719
743
|
decoder: Optional[Decoder] = None
|
|
@@ -887,7 +911,7 @@ class CreateSpeakerInvite(_Base):
|
|
|
887
911
|
|
|
888
912
|
|
|
889
913
|
class CreateTag(_Base):
|
|
890
|
-
color: Optional[Literal["coral", "amber", "lime", "green", "teal", "blue", "violet", "pink"]] = None
|
|
914
|
+
color: Optional[Union[Literal["coral", "amber", "lime", "green", "teal", "blue", "violet", "pink"], str]] = None
|
|
891
915
|
name: str
|
|
892
916
|
|
|
893
917
|
|
|
@@ -906,6 +930,7 @@ class SettingsPatch(_Base):
|
|
|
906
930
|
summary_translations: Optional[bool] = Field(default=None, alias="summaryTranslations")
|
|
907
931
|
title: Optional[bool] = None
|
|
908
932
|
translation_tts: Optional[bool] = Field(default=None, alias="translationTts")
|
|
933
|
+
# Accepted for compatibility and ignored: VocalStack picks the voice (see `Settings.voiceByLang`).
|
|
909
934
|
voice_by_lang: Optional[Dict[str, str]] = Field(default=None, alias="voiceByLang")
|
|
910
935
|
voice_cloning: Optional[bool] = Field(default=None, alias="voiceCloning")
|
|
911
936
|
voice_cloning_consent: Optional[bool] = Field(default=None, alias="voiceCloningConsent")
|
|
@@ -1115,6 +1140,7 @@ class LinkProbe(_Base):
|
|
|
1115
1140
|
source: str
|
|
1116
1141
|
thumbnail_url: Optional[str] = Field(default=None, alias="thumbnailUrl")
|
|
1117
1142
|
title: Optional[str] = None
|
|
1143
|
+
viewer_only: Optional[bool] = Field(default=None, alias="viewerOnly")
|
|
1118
1144
|
|
|
1119
1145
|
|
|
1120
1146
|
class LowBalanceAlertChoices(_Base):
|
|
@@ -1199,6 +1225,8 @@ class Payment(_Base):
|
|
|
1199
1225
|
id: str
|
|
1200
1226
|
kind: str
|
|
1201
1227
|
status: str
|
|
1228
|
+
store: Optional[str] = None
|
|
1229
|
+
store_price: Optional["StorePrice"] = Field(default=None, alias="storePrice")
|
|
1202
1230
|
tax_id: Optional[str] = Field(default=None, alias="taxId")
|
|
1203
1231
|
|
|
1204
1232
|
|
|
@@ -1355,7 +1383,7 @@ class PublisherInfo(_Base):
|
|
|
1355
1383
|
class TagRef(_Base):
|
|
1356
1384
|
"""A tag as a transcription lists it."""
|
|
1357
1385
|
|
|
1358
|
-
color: Literal["coral", "amber", "lime", "green", "teal", "blue", "violet", "pink"]
|
|
1386
|
+
color: Union[Literal["coral", "amber", "lime", "green", "teal", "blue", "violet", "pink"], str]
|
|
1359
1387
|
id: str
|
|
1360
1388
|
name: str
|
|
1361
1389
|
|
|
@@ -1389,7 +1417,7 @@ stream, an RTMP encoder), which may feed broadcasts (`broadcasts`)."""
|
|
|
1389
1417
|
media: Optional[List["MediaSummary"]] = None
|
|
1390
1418
|
metrics: Optional["TranscriptionMetrics"] = None
|
|
1391
1419
|
name: str
|
|
1392
|
-
origin: Literal["dashboard", "api", "extension", "desktop_app", "obs", "wordpress", "payload", "strapi", "sanity", "contentful", "mcp", "broadcast", "unknown"]
|
|
1420
|
+
origin: Union[Literal["dashboard", "api", "extension", "desktop_app", "ios_app", "obs", "wordpress", "payload", "strapi", "sanity", "contentful", "mcp", "broadcast", "unknown"], str]
|
|
1393
1421
|
owner_principal_id: str = Field(alias="ownerPrincipalId")
|
|
1394
1422
|
peak_latency_s: Optional[float] = Field(default=None, alias="peakLatencyS")
|
|
1395
1423
|
peak_listeners: Optional[int] = Field(default=None, alias="peakListeners")
|
|
@@ -1486,6 +1514,7 @@ class SearchResults(_Base):
|
|
|
1486
1514
|
|
|
1487
1515
|
|
|
1488
1516
|
class SegmentView(_Base):
|
|
1517
|
+
# Deprecated: read `decoder` (`fast`), which says the same.
|
|
1489
1518
|
catchup: bool
|
|
1490
1519
|
confidence: Optional[float] = None
|
|
1491
1520
|
corrected: bool
|
|
@@ -1574,6 +1603,7 @@ class SessionOptions(_Base):
|
|
|
1574
1603
|
spoken_language: Optional[str] = Field(default=None, alias="spokenLanguage")
|
|
1575
1604
|
translate: Optional[List[str]] = None
|
|
1576
1605
|
voice: Optional[List[str]] = None
|
|
1606
|
+
# Accepted for compatibility and ignored: VocalStack picks the voice (see `voice`).
|
|
1577
1607
|
voice_by_lang: Optional[Dict[str, str]] = Field(default=None, alias="voiceByLang")
|
|
1578
1608
|
voice_cloning: Optional[bool] = Field(default=None, alias="voiceCloning")
|
|
1579
1609
|
|
|
@@ -1707,13 +1737,14 @@ class SummaryStatus(_Base):
|
|
|
1707
1737
|
|
|
1708
1738
|
|
|
1709
1739
|
class Tag(_Base):
|
|
1710
|
-
color: Literal["coral", "amber", "lime", "green", "teal", "blue", "violet", "pink"]
|
|
1740
|
+
color: Union[Literal["coral", "amber", "lime", "green", "teal", "blue", "violet", "pink"], str]
|
|
1711
1741
|
created_at: str = Field(alias="createdAt")
|
|
1712
1742
|
id: str
|
|
1713
1743
|
name: str
|
|
1714
1744
|
|
|
1715
1745
|
|
|
1716
1746
|
class TagList(_Base):
|
|
1747
|
+
next_cursor: Optional[str] = Field(default=None, alias="nextCursor")
|
|
1717
1748
|
tags: List["Tag"]
|
|
1718
1749
|
|
|
1719
1750
|
|
|
@@ -1774,7 +1805,7 @@ class UpdateShareLink(_Base):
|
|
|
1774
1805
|
|
|
1775
1806
|
|
|
1776
1807
|
class UpdateTag(_Base):
|
|
1777
|
-
color: Optional[Literal["coral", "amber", "lime", "green", "teal", "blue", "violet", "pink"]] = None
|
|
1808
|
+
color: Optional[Union[Literal["coral", "amber", "lime", "green", "teal", "blue", "violet", "pink"], str]] = None
|
|
1778
1809
|
name: Optional[str] = None
|
|
1779
1810
|
|
|
1780
1811
|
|
|
@@ -1938,7 +1969,7 @@ class CaptureSourceStream(_Base):
|
|
|
1938
1969
|
url: str
|
|
1939
1970
|
|
|
1940
1971
|
|
|
1941
|
-
CaptureSource = Annotated[Union[CaptureSourceMic, CaptureSourceStream], Field(discriminator="kind")]
|
|
1972
|
+
CaptureSource = Annotated[Union[Annotated[Union[CaptureSourceMic, CaptureSourceStream], Field(discriminator="kind")], Dict[str, Any]], Field(union_mode="left_to_right")]
|
|
1942
1973
|
|
|
1943
1974
|
class Eof(_Base):
|
|
1944
1975
|
type: Literal["eof"] = "eof"
|
|
@@ -1955,6 +1986,7 @@ class SessionUpdate(_Base):
|
|
|
1955
1986
|
translate: Optional[List[str]] = None
|
|
1956
1987
|
type: Literal["session.update"] = "session.update"
|
|
1957
1988
|
voice: Optional[List[str]] = None
|
|
1989
|
+
# Accepted for compatibility and ignored: VocalStack picks the voice.
|
|
1958
1990
|
voice_by_lang: Optional[Dict[str, str]] = Field(default=None, alias="voiceByLang")
|
|
1959
1991
|
|
|
1960
1992
|
|
|
@@ -2125,8 +2157,8 @@ class StreamPull(_Base):
|
|
|
2125
2157
|
error: Optional[str] = None
|
|
2126
2158
|
failures: int
|
|
2127
2159
|
media_s: float = Field(alias="mediaS")
|
|
2128
|
-
|
|
2129
|
-
|
|
2160
|
+
program_at: Optional[str] = Field(default=None, alias="programAt")
|
|
2161
|
+
sequence_offset_s: Optional[float] = Field(default=None, alias="sequenceOffsetS")
|
|
2130
2162
|
state: PullState
|
|
2131
2163
|
type: Literal["stream.pull"] = "stream.pull"
|
|
2132
2164
|
|
|
@@ -2315,14 +2347,22 @@ SERVER_FRAME_TYPES = frozenset(["session.loading", "session.queued", "session.re
|
|
|
2315
2347
|
|
|
2316
2348
|
_server_frame_adapter: TypeAdapter[ServerFrame] = TypeAdapter(ServerFrame)
|
|
2317
2349
|
|
|
2350
|
+
_SERVER_FRAME_CLASSES: Dict[str, Any] = {"session.loading": SessionLoading, "session.queued": SessionQueued, "session.ready": SessionReady, "transcript.committed": TranscriptCommitted, "transcript.draft": TranscriptDraft, "transcript.words": TranscriptWords, "transcript.amended": TranscriptAmended, "transcript.latency": TranscriptLatency, "transcript.speaker": TranscriptSpeaker, "transcript.speakerGender": TranscriptSpeakerGender, "transcript.speakerIdentified": TranscriptSpeakerIdentified, "transcript.speakerNumbers": TranscriptSpeakerNumbers, "transcript.sentence": TranscriptSentence, "transcript.translated": TranscriptTranslated, "transcript.voice": TranscriptVoice, "transcript.voiceStatus": TranscriptVoiceStatus, "transcript.languageStatus": TranscriptLanguageStatus, "transcript.retracted": TranscriptRetracted, "transcript.held": TranscriptHeld, "transcript.progress": TranscriptProgress, "stream.pull": StreamPull, "source.progress": SourceProgress, "source.prepared": SourcePrepared, "session.done": SessionDone, "error": ErrorFrame}
|
|
2351
|
+
|
|
2318
2352
|
|
|
2319
2353
|
TranscriptEvent = Union[TranscriptCommitted, TranscriptDraft, TranscriptWords, TranscriptAmended, TranscriptLatency, TranscriptSpeaker, TranscriptSpeakerGender, TranscriptSpeakerIdentified, TranscriptSpeakerNumbers, TranscriptSentence, TranscriptTranslated, TranscriptVoice, TranscriptVoiceStatus, TranscriptLanguageStatus, TranscriptRetracted, TranscriptHeld, TranscriptProgress]
|
|
2320
2354
|
|
|
2321
2355
|
|
|
2322
2356
|
def parse_server_frame(text: str) -> Optional[ServerFrame]:
|
|
2323
2357
|
"""Parse one WS text frame. Returns None for unknown frame types
|
|
2324
|
-
(forward compatibility)
|
|
2358
|
+
(forward compatibility); a known frame that does not match its model
|
|
2359
|
+
is still returned, built from its fields unchecked."""
|
|
2325
2360
|
raw = json.loads(text)
|
|
2326
2361
|
if not isinstance(raw, dict) or raw.get("type") not in SERVER_FRAME_TYPES:
|
|
2362
|
+
_log.debug("ignoring server frame of unknown type %r", raw.get("type") if isinstance(raw, dict) else None)
|
|
2327
2363
|
return None
|
|
2328
|
-
|
|
2364
|
+
try:
|
|
2365
|
+
return _server_frame_adapter.validate_python(raw)
|
|
2366
|
+
except ValidationError as e:
|
|
2367
|
+
_log.debug("server frame %r does not match the contract: %s", raw["type"], e)
|
|
2368
|
+
return _SERVER_FRAME_CLASSES[raw["type"]].model_construct(**raw)
|