@livekit/agents-plugin-deepgram 0.0.0-next-20260624041820

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 (75) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +17 -0
  3. package/dist/_utils.cjs +56 -0
  4. package/dist/_utils.cjs.map +1 -0
  5. package/dist/_utils.d.cts +12 -0
  6. package/dist/_utils.d.ts +12 -0
  7. package/dist/_utils.d.ts.map +1 -0
  8. package/dist/_utils.js +32 -0
  9. package/dist/_utils.js.map +1 -0
  10. package/dist/index.cjs +38 -0
  11. package/dist/index.cjs.map +1 -0
  12. package/dist/index.d.cts +4 -0
  13. package/dist/index.d.ts +4 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +15 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/models.cjs +17 -0
  18. package/dist/models.cjs.map +1 -0
  19. package/dist/models.d.cts +6 -0
  20. package/dist/models.d.ts +6 -0
  21. package/dist/models.d.ts.map +1 -0
  22. package/dist/models.js +1 -0
  23. package/dist/models.js.map +1 -0
  24. package/dist/stt.cjs +496 -0
  25. package/dist/stt.cjs.map +1 -0
  26. package/dist/stt.d.cts +53 -0
  27. package/dist/stt.d.ts +53 -0
  28. package/dist/stt.d.ts.map +1 -0
  29. package/dist/stt.js +483 -0
  30. package/dist/stt.js.map +1 -0
  31. package/dist/stt.test.cjs +28 -0
  32. package/dist/stt.test.cjs.map +1 -0
  33. package/dist/stt.test.d.cts +2 -0
  34. package/dist/stt.test.d.ts +2 -0
  35. package/dist/stt.test.d.ts.map +1 -0
  36. package/dist/stt.test.js +27 -0
  37. package/dist/stt.test.js.map +1 -0
  38. package/dist/stt_v2.cjs +413 -0
  39. package/dist/stt_v2.cjs.map +1 -0
  40. package/dist/stt_v2.d.cts +97 -0
  41. package/dist/stt_v2.d.ts +97 -0
  42. package/dist/stt_v2.d.ts.map +1 -0
  43. package/dist/stt_v2.js +387 -0
  44. package/dist/stt_v2.js.map +1 -0
  45. package/dist/stt_v2.test.cjs +17 -0
  46. package/dist/stt_v2.test.cjs.map +1 -0
  47. package/dist/stt_v2.test.d.cts +2 -0
  48. package/dist/stt_v2.test.d.ts +2 -0
  49. package/dist/stt_v2.test.d.ts.map +1 -0
  50. package/dist/stt_v2.test.js +16 -0
  51. package/dist/stt_v2.test.js.map +1 -0
  52. package/dist/tts.cjs +385 -0
  53. package/dist/tts.cjs.map +1 -0
  54. package/dist/tts.d.cts +43 -0
  55. package/dist/tts.d.ts +43 -0
  56. package/dist/tts.d.ts.map +1 -0
  57. package/dist/tts.js +369 -0
  58. package/dist/tts.js.map +1 -0
  59. package/dist/tts.test.cjs +17 -0
  60. package/dist/tts.test.cjs.map +1 -0
  61. package/dist/tts.test.d.cts +2 -0
  62. package/dist/tts.test.d.ts +2 -0
  63. package/dist/tts.test.d.ts.map +1 -0
  64. package/dist/tts.test.js +16 -0
  65. package/dist/tts.test.js.map +1 -0
  66. package/package.json +54 -0
  67. package/src/_utils.ts +50 -0
  68. package/src/index.ts +20 -0
  69. package/src/models.ts +93 -0
  70. package/src/stt.test.ts +36 -0
  71. package/src/stt.ts +612 -0
  72. package/src/stt_v2.test.ts +19 -0
  73. package/src/stt_v2.ts +560 -0
  74. package/src/tts.test.ts +19 -0
  75. package/src/tts.ts +450 -0
package/src/models.ts ADDED
@@ -0,0 +1,93 @@
1
+ // SPDX-FileCopyrightText: 2024 LiveKit, Inc.
2
+ //
3
+ // SPDX-License-Identifier: Apache-2.0
4
+
5
+ export type TTSModels =
6
+ | 'aura-asteria-en'
7
+ | 'aura-luna-en'
8
+ | 'aura-stella-en'
9
+ | 'aura-athena-en'
10
+ | 'aura-hera-en'
11
+ | 'aura-orion-en'
12
+ | 'aura-arcas-en'
13
+ | 'aura-perseus-en'
14
+ | 'aura-angus-en'
15
+ | 'aura-orpheus-en'
16
+ | 'aura-helios-en'
17
+ | 'aura-zeus-en';
18
+
19
+ export type TTSEncoding = 'linear16' | 'mulaw' | 'alaw' | 'mp3' | 'opus' | 'flac' | 'aac';
20
+
21
+ // Ref: python livekit-plugins/livekit-plugins-deepgram/livekit/plugins/deepgram/models.py - 38 line
22
+ export type V2Models = 'flux-general-en' | 'flux-general-multi';
23
+
24
+ export type STTModels =
25
+ | 'nova-general'
26
+ | 'nova-phonecall'
27
+ | 'nova-meeting'
28
+ | 'nova-2-general'
29
+ | 'nova-2-meeting'
30
+ | 'nova-2-phonecall'
31
+ | 'nova-2-finance'
32
+ | 'nova-2-conversationalai'
33
+ | 'nova-2-voicemail'
34
+ | 'nova-2-video'
35
+ | 'nova-2-medical'
36
+ | 'nova-2-drivethru'
37
+ | 'nova-2-automotive'
38
+ | 'nova-3'
39
+ | 'nova-3-general'
40
+ | 'nova-3-medical'
41
+ | 'enhanced-general'
42
+ | 'enhanced-meeting'
43
+ | 'enhanced-phonecall'
44
+ | 'enhanced-finance'
45
+ | 'base'
46
+ | 'meeting'
47
+ | 'phonecall'
48
+ | 'finance'
49
+ | 'conversationalai'
50
+ | 'voicemail'
51
+ | 'video'
52
+ | 'whisper-tiny'
53
+ | 'whisper-base'
54
+ | 'whisper-small'
55
+ | 'whisper-medium'
56
+ | 'whisper-large';
57
+
58
+ export type STTLanguages =
59
+ | 'da'
60
+ | 'de'
61
+ | 'en'
62
+ | 'en-AU'
63
+ | 'en-GB'
64
+ | 'en-IN'
65
+ | 'en-NZ'
66
+ | 'en-US'
67
+ | 'es'
68
+ | 'es-419'
69
+ | 'es-LATAM'
70
+ | 'fr'
71
+ | 'fr-CA'
72
+ | 'hi'
73
+ | 'hi-Latn'
74
+ | 'id'
75
+ | 'it'
76
+ | 'ja'
77
+ | 'ko'
78
+ | 'nl'
79
+ | 'no'
80
+ | 'pl'
81
+ | 'pt'
82
+ | 'pt-BR'
83
+ | 'ru'
84
+ | 'sv'
85
+ | 'ta'
86
+ | 'taq'
87
+ | 'th'
88
+ | 'tr'
89
+ | 'uk'
90
+ | 'zh'
91
+ | 'zh-CN'
92
+ | 'zh-TW'
93
+ | 'multi';
@@ -0,0 +1,36 @@
1
+ // SPDX-FileCopyrightText: 2024 LiveKit, Inc.
2
+ //
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ import { VAD } from '@livekit/agents-plugin-silero';
5
+ import { stt } from '@livekit/agents-plugins-test';
6
+ import { describe, expect, it } from 'vitest';
7
+ import { STT } from './stt.js';
8
+
9
+ const hasDeepgramApiKey = Boolean(process.env.DEEPGRAM_API_KEY);
10
+
11
+ describe('Deepgram streaming language detection', () => {
12
+ // Deepgram only supports language detection for prerecorded audio, so a
13
+ // streaming session must reject it rather than silently default to English.
14
+ // Mirrors livekit-plugins-deepgram (Python).
15
+ it('throws when starting a stream with detectLanguage enabled', () => {
16
+ const stt = new STT({ apiKey: 'test', detectLanguage: true });
17
+ expect(() => stt.stream()).toThrow('language detection is not supported in streaming mode');
18
+ });
19
+
20
+ it('allows streaming with an explicit language', () => {
21
+ const stt = new STT({ apiKey: 'test', language: 'en-US' });
22
+ const stream = stt.stream();
23
+ // Close immediately so the connection loop never starts (no network in unit tests).
24
+ stream.close();
25
+ });
26
+ });
27
+
28
+ if (hasDeepgramApiKey) {
29
+ describe('Deepgram', async () => {
30
+ await stt(new STT(), await VAD.load(), { nonStreaming: false });
31
+ });
32
+ } else {
33
+ describe('Deepgram', () => {
34
+ it.skip('requires DEEPGRAM_API_KEY', () => {});
35
+ });
36
+ }