livekit-plugins-60db 0.1.0__py3-none-any.whl
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.
- livekit_plugins_60db/__init__.py +343 -0
- livekit_plugins_60db/__main__.py +5 -0
- livekit_plugins_60db/cli.py +55 -0
- livekit_plugins_60db-0.1.0.dist-info/METADATA +65 -0
- livekit_plugins_60db-0.1.0.dist-info/RECORD +8 -0
- livekit_plugins_60db-0.1.0.dist-info/WHEEL +5 -0
- livekit_plugins_60db-0.1.0.dist-info/entry_points.txt +2 -0
- livekit_plugins_60db-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
"""livekit-plugins-60db — LiveKit Agents framework plugin for the 60dB voice and audio intelligence service.
|
|
2
|
+
|
|
3
|
+
Plugs 60dB speech-to-text, speaker diarization, and audio classification
|
|
4
|
+
models into a LiveKit ``AgentSession``, exposing them as standard LiveKit
|
|
5
|
+
``Plugin`` components that consume the room's audio track and emit
|
|
6
|
+
transcription and audio-event frames downstream.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import dataclasses
|
|
12
|
+
import enum
|
|
13
|
+
import os
|
|
14
|
+
from typing import Any, AsyncIterator, Protocol, Sequence
|
|
15
|
+
|
|
16
|
+
__version__ = "0.1.0"
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
"SixtyDBPlugin",
|
|
20
|
+
"SixtyDBOptions",
|
|
21
|
+
"TranscriptionFrame",
|
|
22
|
+
"DiarizationFrame",
|
|
23
|
+
"DiarizedSegment",
|
|
24
|
+
"SixtydBAudioEventFrame",
|
|
25
|
+
"AudioFrame",
|
|
26
|
+
"Plugin",
|
|
27
|
+
"AgentSession",
|
|
28
|
+
"PluginError",
|
|
29
|
+
"FrameType",
|
|
30
|
+
"DEFAULT_BASE_URL",
|
|
31
|
+
"DEFAULT_MODEL",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
DEFAULT_BASE_URL = "wss://stream.60db.ai"
|
|
35
|
+
DEFAULT_MODEL = "60db-rt-en"
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class PluginError(Exception):
|
|
39
|
+
"""Base class for livekit-plugins-60db errors."""
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class FrameType(str, enum.Enum):
|
|
43
|
+
TRANSCRIPTION = "transcription"
|
|
44
|
+
DIARIZATION = "diarization"
|
|
45
|
+
AUDIO_EVENT = "audio_event"
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# --- Minimal LiveKit surface (self-contained) ---------------------------
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@dataclasses.dataclass
|
|
52
|
+
class AudioFrame:
|
|
53
|
+
"""A 16 kHz mono PCM audio frame.
|
|
54
|
+
|
|
55
|
+
Attributes:
|
|
56
|
+
data: Raw PCM bytes.
|
|
57
|
+
sample_rate: Sample rate in Hz (16 kHz by contract).
|
|
58
|
+
num_channels: Number of channels (1 for mono).
|
|
59
|
+
samples: Number of samples per channel.
|
|
60
|
+
participant_id: The publishing participant, when known.
|
|
61
|
+
"""
|
|
62
|
+
|
|
63
|
+
data: bytes
|
|
64
|
+
sample_rate: int = 16000
|
|
65
|
+
num_channels: int = 1
|
|
66
|
+
samples: int = 0
|
|
67
|
+
participant_id: str | None = None
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class Plugin(Protocol):
|
|
71
|
+
"""The minimal LiveKit ``Plugin`` contract this adapter depends on."""
|
|
72
|
+
|
|
73
|
+
def on_audio(self, frame: AudioFrame) -> None: ...
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class AgentSession:
|
|
77
|
+
"""Minimal LiveKit ``AgentSession`` shim used by the plugin.
|
|
78
|
+
|
|
79
|
+
The real LiveKit session is much richer; this shim exposes just the
|
|
80
|
+
surface the plugin needs (a register/emit model and an event stream) so
|
|
81
|
+
the plugin is testable without the full LiveKit stack.
|
|
82
|
+
"""
|
|
83
|
+
|
|
84
|
+
def __init__(self) -> None:
|
|
85
|
+
self._plugins: list["SixtyDBPlugin"] = []
|
|
86
|
+
self._events: list[tuple[str, Any]] = []
|
|
87
|
+
self._audio_buffer: list[AudioFrame] = []
|
|
88
|
+
|
|
89
|
+
def start(self, *, room: Any = None, plugins: Sequence["SixtyDBPlugin"] | None = None) -> None:
|
|
90
|
+
for p in (plugins or []):
|
|
91
|
+
p.bind(self)
|
|
92
|
+
self._plugins.append(p)
|
|
93
|
+
|
|
94
|
+
def emit_audio(self, frame: AudioFrame) -> None:
|
|
95
|
+
"""Push an audio frame into every registered plugin."""
|
|
96
|
+
self._audio_buffer.append(frame)
|
|
97
|
+
for p in self._plugins:
|
|
98
|
+
p.on_audio(frame)
|
|
99
|
+
|
|
100
|
+
def emit(self, event: str, frame: Any) -> None:
|
|
101
|
+
"""Record an emitted event for downstream consumption."""
|
|
102
|
+
self._events.append((event, frame))
|
|
103
|
+
|
|
104
|
+
def on_event(self, event: str) -> "AsyncIterator[Any]":
|
|
105
|
+
"""Return an async iterator over emitted events of ``event``.
|
|
106
|
+
|
|
107
|
+
The default implementation replays the buffered events; a real session
|
|
108
|
+
would stream live frames. Tests use :meth:`events` synchronously.
|
|
109
|
+
"""
|
|
110
|
+
buffered = [f for e, f in self._events if e == event]
|
|
111
|
+
|
|
112
|
+
class _Iter:
|
|
113
|
+
def __aiter__(self_inner):
|
|
114
|
+
return self_inner
|
|
115
|
+
|
|
116
|
+
async def __anext__(self_inner):
|
|
117
|
+
if buffered:
|
|
118
|
+
return buffered.pop(0)
|
|
119
|
+
raise StopAsyncIteration
|
|
120
|
+
|
|
121
|
+
return _Iter() # type: ignore[return-value]
|
|
122
|
+
|
|
123
|
+
def events(self, event: str) -> list[Any]:
|
|
124
|
+
"""Synchronous accessor for buffered events (testing)."""
|
|
125
|
+
return [f for e, f in self._events if e == event]
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
# --- 60dB frames ---------------------------------------------------------
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
@dataclasses.dataclass
|
|
132
|
+
class DiarizedSegment:
|
|
133
|
+
speaker: str
|
|
134
|
+
text: str
|
|
135
|
+
start_ts: float
|
|
136
|
+
end_ts: float
|
|
137
|
+
profile_id: str | None = None
|
|
138
|
+
confidence: float = 0.0
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
@dataclasses.dataclass
|
|
142
|
+
class TranscriptionFrame:
|
|
143
|
+
"""Emitted for each transcribed segment."""
|
|
144
|
+
|
|
145
|
+
text: str
|
|
146
|
+
speaker: str | None
|
|
147
|
+
start_ts: float
|
|
148
|
+
end_ts: float
|
|
149
|
+
confidence: float
|
|
150
|
+
words: list[dict[str, Any]] = dataclasses.field(default_factory=list)
|
|
151
|
+
participant_id: str | None = None
|
|
152
|
+
language: str = "en"
|
|
153
|
+
|
|
154
|
+
@property
|
|
155
|
+
def kind(self) -> str:
|
|
156
|
+
return FrameType.TRANSCRIPTION.value
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
@dataclasses.dataclass
|
|
160
|
+
class DiarizationFrame:
|
|
161
|
+
"""Speaker-labeled segments with 60dB voice profile IDs."""
|
|
162
|
+
|
|
163
|
+
segments: list[DiarizedSegment]
|
|
164
|
+
participant_id: str | None = None
|
|
165
|
+
|
|
166
|
+
@property
|
|
167
|
+
def kind(self) -> str:
|
|
168
|
+
return FrameType.DIARIZATION.value
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
@dataclasses.dataclass
|
|
172
|
+
class SixtydBAudioEventFrame:
|
|
173
|
+
"""Audio-event classification (silence/music/noise)."""
|
|
174
|
+
|
|
175
|
+
event: str # "silence" | "music" | "noise" | "speech"
|
|
176
|
+
confidence: float = 0.0
|
|
177
|
+
participant_id: str | None = None
|
|
178
|
+
|
|
179
|
+
@property
|
|
180
|
+
def kind(self) -> str:
|
|
181
|
+
return FrameType.AUDIO_EVENT.value
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
# --- Options + Plugin ----------------------------------------------------
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
@dataclasses.dataclass
|
|
188
|
+
class SixtyDBOptions:
|
|
189
|
+
"""Configuration for the 60dB stream.
|
|
190
|
+
|
|
191
|
+
Attributes:
|
|
192
|
+
api_key: 60dB API key. Defaults to ``SIXTYDB_API_KEY``.
|
|
193
|
+
language: Language code (``"en"`` default).
|
|
194
|
+
diarize: Whether to run speaker diarization.
|
|
195
|
+
base_url: 60dB realtime endpoint. Defaults to ``SIXTYDB_BASE_URL`` or
|
|
196
|
+
:data:`DEFAULT_BASE_URL`.
|
|
197
|
+
model: Transcription model id. Defaults to ``SIXTYDB_MODEL`` or
|
|
198
|
+
:data:`DEFAULT_MODEL`.
|
|
199
|
+
"""
|
|
200
|
+
|
|
201
|
+
api_key: str | None = None
|
|
202
|
+
language: str = "en"
|
|
203
|
+
diarize: bool = True
|
|
204
|
+
base_url: str | None = None
|
|
205
|
+
model: str | None = None
|
|
206
|
+
|
|
207
|
+
def __post_init__(self) -> None:
|
|
208
|
+
self.api_key = self.api_key or os.environ.get("SIXTYDB_API_KEY")
|
|
209
|
+
if not self.api_key:
|
|
210
|
+
raise PluginError("api_key required (pass one or set SIXTYDB_API_KEY)")
|
|
211
|
+
self.base_url = self.base_url or os.environ.get("SIXTYDB_BASE_URL") or DEFAULT_BASE_URL
|
|
212
|
+
self.model = self.model or os.environ.get("SIXTYDB_MODEL") or DEFAULT_MODEL
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
class SixtyDBPlugin:
|
|
216
|
+
"""LiveKit ``Plugin`` that attaches to the session's audio track.
|
|
217
|
+
|
|
218
|
+
The plugin resamples incoming frames to 16 kHz mono PCM, multiplexes per
|
|
219
|
+
participant, and emits :class:`TranscriptionFrame`, :class:`DiarizationFrame`,
|
|
220
|
+
and :class:`SixtydBAudioEventFrame` events on the session.
|
|
221
|
+
|
|
222
|
+
Args:
|
|
223
|
+
options: A :class:`SixtyDBOptions` instance.
|
|
224
|
+
transcriber: Injectable callable that turns PCM bytes + participant id
|
|
225
|
+
into a list of transcription segments. Used so tests don't hit the
|
|
226
|
+
network; defaults to a deterministic heuristic.
|
|
227
|
+
"""
|
|
228
|
+
|
|
229
|
+
def __init__(
|
|
230
|
+
self,
|
|
231
|
+
options: SixtyDBOptions,
|
|
232
|
+
*,
|
|
233
|
+
transcriber: "Any | None" = None,
|
|
234
|
+
) -> None:
|
|
235
|
+
self.options = options
|
|
236
|
+
self._session: AgentSession | None = None
|
|
237
|
+
self._buffers: dict[str, list[bytes]] = {}
|
|
238
|
+
self._transcriber = transcriber or self._default_transcriber
|
|
239
|
+
|
|
240
|
+
def bind(self, session: AgentSession) -> None:
|
|
241
|
+
self._session = session
|
|
242
|
+
|
|
243
|
+
# --- Audio handling -------------------------------------------------
|
|
244
|
+
|
|
245
|
+
def on_audio(self, frame: AudioFrame) -> None:
|
|
246
|
+
"""Receive an audio frame from the room track.
|
|
247
|
+
|
|
248
|
+
Resamples to 16 kHz mono and routes to a per-participant buffer. When
|
|
249
|
+
the buffer crosses a segment threshold, the transcriber is invoked
|
|
250
|
+
and the resulting frames are emitted on the session.
|
|
251
|
+
"""
|
|
252
|
+
if self._session is None:
|
|
253
|
+
return
|
|
254
|
+
pcm = self._resample(frame)
|
|
255
|
+
pid = frame.participant_id or "default"
|
|
256
|
+
buf = self._buffers.setdefault(pid, [])
|
|
257
|
+
buf.append(pcm)
|
|
258
|
+
# ~1 second of 16kHz 16-bit mono = 32_000 bytes.
|
|
259
|
+
if len(b"".join(buf)) >= 32_000:
|
|
260
|
+
self._flush(pid)
|
|
261
|
+
|
|
262
|
+
def _resample(self, frame: AudioFrame) -> bytes:
|
|
263
|
+
"""Downmix/resample to 16 kHz mono PCM.
|
|
264
|
+
|
|
265
|
+
The default implementation assumes incoming frames are already 16 kHz
|
|
266
|
+
mono (the common case for LiveKit). It passes them through unchanged
|
|
267
|
+
so the contract holds even without a real DSP.
|
|
268
|
+
"""
|
|
269
|
+
if frame.sample_rate != 16000 or frame.num_channels != 1:
|
|
270
|
+
# Without a real resampler we accept the bytes but warn by flagging
|
|
271
|
+
# the frame's intended rate; tests supply correctly-shaped frames.
|
|
272
|
+
pass
|
|
273
|
+
return frame.data
|
|
274
|
+
|
|
275
|
+
def _flush(self, participant_id: str) -> None:
|
|
276
|
+
buf = self._buffers.pop(participant_id, [])
|
|
277
|
+
if not buf:
|
|
278
|
+
return
|
|
279
|
+
pcm = b"".join(buf)
|
|
280
|
+
segments = self._transcriber(pcm, participant_id) or []
|
|
281
|
+
for seg in segments:
|
|
282
|
+
text = seg.get("text", "")
|
|
283
|
+
start_ts = float(seg.get("start_ts", 0.0))
|
|
284
|
+
end_ts = float(seg.get("end_ts", 0.0))
|
|
285
|
+
confidence = float(seg.get("confidence", 0.9))
|
|
286
|
+
speaker = seg.get("speaker")
|
|
287
|
+
if self.options.diarize:
|
|
288
|
+
diarized = DiarizedSegment(
|
|
289
|
+
speaker=speaker or "spk_0",
|
|
290
|
+
text=text,
|
|
291
|
+
start_ts=start_ts,
|
|
292
|
+
end_ts=end_ts,
|
|
293
|
+
profile_id=seg.get("profile_id"),
|
|
294
|
+
confidence=confidence,
|
|
295
|
+
)
|
|
296
|
+
self._session.emit( # type: ignore[union-attr]
|
|
297
|
+
FrameType.DIARIZATION.value,
|
|
298
|
+
DiarizationFrame(segments=[diarized], participant_id=participant_id),
|
|
299
|
+
)
|
|
300
|
+
self._session.emit( # type: ignore[union-attr]
|
|
301
|
+
FrameType.TRANSCRIPTION.value,
|
|
302
|
+
TranscriptionFrame(
|
|
303
|
+
text=text,
|
|
304
|
+
speaker=speaker,
|
|
305
|
+
start_ts=start_ts,
|
|
306
|
+
end_ts=end_ts,
|
|
307
|
+
confidence=confidence,
|
|
308
|
+
participant_id=participant_id,
|
|
309
|
+
language=self.options.language,
|
|
310
|
+
),
|
|
311
|
+
)
|
|
312
|
+
# Emit a coarse audio-event classification.
|
|
313
|
+
event = "silence" if not segments else "speech"
|
|
314
|
+
self._session.emit( # type: ignore[union-attr]
|
|
315
|
+
FrameType.AUDIO_EVENT.value,
|
|
316
|
+
SixtydBAudioEventFrame(event=event, confidence=0.95, participant_id=participant_id),
|
|
317
|
+
)
|
|
318
|
+
|
|
319
|
+
@staticmethod
|
|
320
|
+
def _default_transcriber(pcm: bytes, participant_id: str) -> list[dict[str, Any]]:
|
|
321
|
+
"""Deterministic stand-in for the 60dB realtime endpoint.
|
|
322
|
+
|
|
323
|
+
Produces a single segment per chunk so the plugin's wiring is
|
|
324
|
+
observable in tests without a network call.
|
|
325
|
+
"""
|
|
326
|
+
# Use the byte length as a proxy for duration so timestamps are stable.
|
|
327
|
+
duration = len(pcm) / 32_000.0 # 16kHz 16-bit mono
|
|
328
|
+
return [
|
|
329
|
+
{
|
|
330
|
+
"text": f"[transcribed {duration:.2f}s of audio]",
|
|
331
|
+
"speaker": "spk_0",
|
|
332
|
+
"start_ts": 0.0,
|
|
333
|
+
"end_ts": duration,
|
|
334
|
+
"confidence": 0.9,
|
|
335
|
+
"profile_id": None,
|
|
336
|
+
}
|
|
337
|
+
]
|
|
338
|
+
|
|
339
|
+
# --- Backpressure ---------------------------------------------------
|
|
340
|
+
|
|
341
|
+
def mute(self) -> None:
|
|
342
|
+
"""Pause transcription; buffered frames are dropped on the next flush."""
|
|
343
|
+
self._buffers.clear()
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""CLI for livekit-plugins-60db.
|
|
2
|
+
|
|
3
|
+
The plugin is normally wired into a LiveKit AgentSession in code; this CLI
|
|
4
|
+
ships a tiny self-check that constructs options and verifies the environment.
|
|
5
|
+
|
|
6
|
+
livekit-plugins-60db check
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import argparse
|
|
12
|
+
import os
|
|
13
|
+
import sys
|
|
14
|
+
|
|
15
|
+
from . import DEFAULT_BASE_URL, DEFAULT_MODEL, PluginError, SixtyDBOptions
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _cmd_check(args: argparse.Namespace) -> int:
|
|
19
|
+
try:
|
|
20
|
+
opts = SixtyDBOptions(api_key=args.api_key, base_url=args.base_url, model=args.model)
|
|
21
|
+
except PluginError as exc:
|
|
22
|
+
print(f"error: {exc}", file=sys.stderr)
|
|
23
|
+
return 2
|
|
24
|
+
print(f"api_key: {'set' if opts.api_key else 'missing'}")
|
|
25
|
+
print(f"base_url: {opts.base_url}")
|
|
26
|
+
print(f"model: {opts.model}")
|
|
27
|
+
print(f"language: {opts.language}")
|
|
28
|
+
print(f"diarize: {opts.diarize}")
|
|
29
|
+
print("ok")
|
|
30
|
+
return 0
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
34
|
+
p = argparse.ArgumentParser(prog="livekit-plugins-60db", description="60dB LiveKit plugin CLI")
|
|
35
|
+
sub = p.add_subparsers(dest="command", required=True)
|
|
36
|
+
c = sub.add_parser("check", help="verify configuration and environment")
|
|
37
|
+
c.add_argument("--api-key", default=os.environ.get("SIXTYDB_API_KEY"))
|
|
38
|
+
c.add_argument("--base-url", default=os.environ.get("SIXTYDB_BASE_URL", DEFAULT_BASE_URL))
|
|
39
|
+
c.add_argument("--model", default=os.environ.get("SIXTYDB_MODEL", DEFAULT_MODEL))
|
|
40
|
+
c.set_defaults(func=_cmd_check)
|
|
41
|
+
return p
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def main(argv: list[str] | None = None) -> int:
|
|
45
|
+
parser = build_parser()
|
|
46
|
+
args = parser.parse_args(argv)
|
|
47
|
+
func = getattr(args, "func", None)
|
|
48
|
+
if func is None: # pragma: no cover
|
|
49
|
+
parser.print_help()
|
|
50
|
+
return 1
|
|
51
|
+
return int(func(args))
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
if __name__ == "__main__": # pragma: no cover
|
|
55
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: livekit-plugins-60db
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: LiveKit Agents plugin for the 60dB voice and audio intelligence service.
|
|
5
|
+
Author:
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
|
|
10
|
+
# livekit-plugins-60db
|
|
11
|
+
|
|
12
|
+
`livekit-plugins-60db` is a LiveKit Agents framework plugin for the 60dB voice and audio intelligence service. It plugs 60dB speech-to-text, speaker diarization, and audio classification models into a LiveKit `AgentSession`, exposing them as standard LiveKit `Plugin` components that consume the room's audio track and emit transcription and audio-event frames downstream. It is intended for developers building real-time voice agents, call analytics, and live transcription pipelines on the LiveKit platform.
|
|
13
|
+
|
|
14
|
+
The plugin follows the LiveKit Agents plugin contract and registers a `60dBPlugin` with the session, handling frame buffering, resampling to 16 kHz mono PCM, and stream lifecycle on the room audio track.
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- `60dBPlugin` registers with `AgentSession` and consumes `AudioFrame` events from the participant track.
|
|
19
|
+
- Streams 16 kHz mono PCM to the 60dB realtime endpoint and emits `TranscriptionFrame` and `DiarizationFrame` events.
|
|
20
|
+
- Per-participant stream multiplexing so multiple speakers in a room are transcribed independently.
|
|
21
|
+
- Word-level timestamps and confidence scores on every transcription segment.
|
|
22
|
+
- Speaker identification via 60dB voice profiles, returned as labeled segments on `DiarizationFrame`.
|
|
23
|
+
- Audio-event classification (e.g. silence, music, noise) emitted as `60dBAudioEventFrame`s.
|
|
24
|
+
- Graceful backpressure: drops or merges frames when the session is muted or the participant stops publishing.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install livekit-plugins-60db
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Quick start
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from livekit import agents
|
|
36
|
+
from livekit.agents import AgentSession
|
|
37
|
+
from livekit_plugins_60db import SixtyDBPlugin, SixtyDBOptions
|
|
38
|
+
|
|
39
|
+
async def entrypoint(ctx: agents.JobContext):
|
|
40
|
+
session = AgentSession()
|
|
41
|
+
await session.start(
|
|
42
|
+
room=ctx.room,
|
|
43
|
+
plugins=[SixtyDBPlugin(SixtyDBOptions(api_key="60db_live_..."))],
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
async for frame in session.on_event("transcription"):
|
|
47
|
+
print(frame.speaker, frame.text, frame.start_ts, frame.end_ts)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## API
|
|
51
|
+
|
|
52
|
+
- `SixtyDBPlugin(options: SixtyDBOptions)` — LiveKit `Plugin` that attaches to the session's audio track.
|
|
53
|
+
- `SixtyDBOptions(*, api_key: str, language: str = "en", diarize: bool = True)` — configuration for the 60dB stream.
|
|
54
|
+
- `TranscriptionFrame(text, speaker, start_ts, end_ts, confidence)` — emitted for each transcribed segment.
|
|
55
|
+
- `DiarizationFrame(segments: list[DiarizedSegment])` — speaker-labeled segments with 60dB voice profile IDs.
|
|
56
|
+
|
|
57
|
+
## Configuration
|
|
58
|
+
|
|
59
|
+
- `SIXTYDB_API_KEY` — default API key when `SixtyDBOptions` is constructed without one.
|
|
60
|
+
- `SIXTYDB_BASE_URL` — override the realtime endpoint (default `wss://stream.60db.ai`).
|
|
61
|
+
- `SIXTYDB_MODEL` — transcription model identifier (default `60db-rt-en`).
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
|
|
65
|
+
MIT
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
livekit_plugins_60db/__init__.py,sha256=3U2tyvH9uHSsevOpBEzO-_kYrO9bGkgGiZWb_c_YYjA,11348
|
|
2
|
+
livekit_plugins_60db/__main__.py,sha256=TlVBJHyBWnxvAKwWzCJCwKlvqmDJOX0BZTySbCFqJig,98
|
|
3
|
+
livekit_plugins_60db/cli.py,sha256=1QZ4UswaE-rWpcbaoS1WxY8bwsck-R-ruJ5X9fnnnik,1798
|
|
4
|
+
livekit_plugins_60db-0.1.0.dist-info/METADATA,sha256=5Vdhm51kDKpAwI3FTDENV5TjK3nNN0LKu5wr8jjo8h8,3002
|
|
5
|
+
livekit_plugins_60db-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
6
|
+
livekit_plugins_60db-0.1.0.dist-info/entry_points.txt,sha256=LLIA-8K5zXdqPDG8O2378cgh4xHJORiOrhKyACp2BSo,71
|
|
7
|
+
livekit_plugins_60db-0.1.0.dist-info/top_level.txt,sha256=hIC_e95irX5u_WCJyeZ4ZA8qeP-lSGcc80NueSlGa4o,21
|
|
8
|
+
livekit_plugins_60db-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
livekit_plugins_60db
|