@livekit/agents-plugin-cartesia 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.
- package/LICENSE +201 -0
- package/README.md +24 -0
- package/dist/index.cjs +36 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/models.cjs +35 -0
- package/dist/models.cjs.map +1 -0
- package/dist/models.d.cts +27 -0
- package/dist/models.d.ts +27 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +9 -0
- package/dist/models.js.map +1 -0
- package/dist/stt.cjs +422 -0
- package/dist/stt.cjs.map +1 -0
- package/dist/stt.d.cts +53 -0
- package/dist/stt.d.ts +53 -0
- package/dist/stt.d.ts.map +1 -0
- package/dist/stt.js +407 -0
- package/dist/stt.js.map +1 -0
- package/dist/stt.test.cjs +17 -0
- package/dist/stt.test.cjs.map +1 -0
- package/dist/stt.test.d.cts +2 -0
- package/dist/stt.test.d.ts +2 -0
- package/dist/stt.test.d.ts.map +1 -0
- package/dist/stt.test.js +16 -0
- package/dist/stt.test.js.map +1 -0
- package/dist/tts.cjs +596 -0
- package/dist/tts.cjs.map +1 -0
- package/dist/tts.d.cts +56 -0
- package/dist/tts.d.ts +56 -0
- package/dist/tts.d.ts.map +1 -0
- package/dist/tts.js +596 -0
- package/dist/tts.js.map +1 -0
- package/dist/tts.test.cjs +17 -0
- package/dist/tts.test.cjs.map +1 -0
- package/dist/tts.test.d.cts +2 -0
- package/dist/tts.test.d.ts +2 -0
- package/dist/tts.test.d.ts.map +1 -0
- package/dist/tts.test.js +16 -0
- package/dist/tts.test.js.map +1 -0
- package/dist/types.cjs +124 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +133 -0
- package/dist/types.d.ts +133 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +87 -0
- package/dist/types.js.map +1 -0
- package/package.json +55 -0
- package/src/index.ts +19 -0
- package/src/models.ts +77 -0
- package/src/stt.test.ts +19 -0
- package/src/stt.ts +653 -0
- package/src/tts.test.ts +19 -0
- package/src/tts.ts +799 -0
- package/src/types.ts +116 -0
package/src/models.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2024 LiveKit, Inc.
|
|
2
|
+
//
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* LiveKit uses this encoding for all audio
|
|
7
|
+
*/
|
|
8
|
+
export const AUDIO_ENCODING = 'pcm_s16le';
|
|
9
|
+
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// TTS
|
|
12
|
+
// ============================================================================
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* See [the docs](https://docs.cartesia.ai/build-with-cartesia/tts-models/latest) for all options.
|
|
16
|
+
*/
|
|
17
|
+
export type TTSModels =
|
|
18
|
+
| 'sonic'
|
|
19
|
+
| 'sonic-2'
|
|
20
|
+
| 'sonic-3'
|
|
21
|
+
| 'sonic-lite'
|
|
22
|
+
| 'sonic-preview'
|
|
23
|
+
| 'sonic-turbo';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* See [the docs](https://docs.cartesia.ai/build-with-cartesia/tts-models/latest) for all options.
|
|
27
|
+
*/
|
|
28
|
+
export type TTSLanguages = 'en' | 'es' | 'fr' | 'de' | 'pt' | 'zh' | 'ja';
|
|
29
|
+
|
|
30
|
+
export const TTSDefaultVoiceId = 'f786b574-daa5-4673-aa0c-cbe3e8534c02';
|
|
31
|
+
|
|
32
|
+
export const isSonic3 = (model: string): boolean => model.startsWith('sonic-3');
|
|
33
|
+
|
|
34
|
+
export type TTSVoiceSpeed = 'fastest' | 'fast' | 'normal' | 'slow' | 'slowest';
|
|
35
|
+
|
|
36
|
+
export type TTSVoiceEmotion =
|
|
37
|
+
| 'anger:lowest'
|
|
38
|
+
| 'anger:low'
|
|
39
|
+
| 'anger'
|
|
40
|
+
| 'anger:high'
|
|
41
|
+
| 'anger:highest'
|
|
42
|
+
| 'positivity:lowest'
|
|
43
|
+
| 'positivity:low'
|
|
44
|
+
| 'positivity'
|
|
45
|
+
| 'positivity:high'
|
|
46
|
+
| 'positivity:highest'
|
|
47
|
+
| 'surprise:lowest'
|
|
48
|
+
| 'surprise:low'
|
|
49
|
+
| 'surprise'
|
|
50
|
+
| 'surprise:high'
|
|
51
|
+
| 'surprise:highest'
|
|
52
|
+
| 'sadness:lowest'
|
|
53
|
+
| 'sadness:low'
|
|
54
|
+
| 'sadness'
|
|
55
|
+
| 'sadness:high'
|
|
56
|
+
| 'sadness:highest'
|
|
57
|
+
| 'curiosity:lowest'
|
|
58
|
+
| 'curiosity:low'
|
|
59
|
+
| 'curiosity'
|
|
60
|
+
| 'curiosity:high'
|
|
61
|
+
| 'curiosity:highest';
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @deprecated Encoding should not be parameterized. Only `pcm_s16le`is allowed. Prefer using {@link AUDIO_ENCODING}.
|
|
65
|
+
*/
|
|
66
|
+
export type TTSEncoding = 'pcm_s16le';
|
|
67
|
+
|
|
68
|
+
// ============================================================================
|
|
69
|
+
// STT
|
|
70
|
+
// ============================================================================
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* See [the docs](https://docs.cartesia.ai/build-with-cartesia/stt-models/latest) for all options.
|
|
74
|
+
*
|
|
75
|
+
* `ink-2` currently supports English only; `ink-whisper` is multilingual.
|
|
76
|
+
*/
|
|
77
|
+
export type STTModel = 'ink-2' | 'ink-whisper';
|
package/src/stt.test.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 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, it } from 'vitest';
|
|
7
|
+
import { STT } from './stt.js';
|
|
8
|
+
|
|
9
|
+
const hasCartesiaApiKey = Boolean(process.env.CARTESIA_API_KEY);
|
|
10
|
+
|
|
11
|
+
if (hasCartesiaApiKey) {
|
|
12
|
+
describe('Cartesia STT', async () => {
|
|
13
|
+
await stt(new STT(), await VAD.load(), { nonStreaming: false });
|
|
14
|
+
});
|
|
15
|
+
} else {
|
|
16
|
+
describe('Cartesia STT', () => {
|
|
17
|
+
it.skip('requires CARTESIA_API_KEY', () => {});
|
|
18
|
+
});
|
|
19
|
+
}
|