@sathamai/livekit-plugin 0.1.2 → 0.1.4
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/README.md +4 -3
- package/dist/realtime.d.ts +1 -1
- package/dist/tts.d.ts +17 -4
- package/dist/tts.js +8 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -146,6 +146,7 @@ preset on the server and is not needed.
|
|
|
146
146
|
| `voice` | text, up to 64 characters | the language's | `voice` | |
|
|
147
147
|
| `breaths` | true / false, or `null` | off | - | |
|
|
148
148
|
| `naturalPauses` | true / false, or `null` | off | - | |
|
|
149
|
+
| `variant` | `'natural'` / `'warm'`, or `null` | the agent's, else natural | - | the voice's sound, from the next reply |
|
|
149
150
|
| `continuation` | true / false, or `null` | true | - | each phrase carries on from the one before; needs session controls |
|
|
150
151
|
| `speed` | 1 to 1 | 1.0 | `speed` | 1.0 only today; needs session controls |
|
|
151
152
|
| `phrasing.first_phrase_max_chars` | 1 to 120 | 120 | - | at least min_phrase_chars; needs session controls |
|
|
@@ -197,11 +198,11 @@ const session = new voice.AgentSession({
|
|
|
197
198
|
them one at a time. Each comes back streamed as raw PCM and goes out frame by frame as it arrives,
|
|
198
199
|
so the audio starts as soon as it is made. 24 kHz, mono.
|
|
199
200
|
- **Options:** `url`, `apiKey`, `voice` (a named voice such as `naina`, `malar` or `vikram`, or an
|
|
200
|
-
alias such as `hi-female`), `language`, `tone`, `pace`, `instructions`, `breaths`, `naturalPauses` and `model`, as in
|
|
201
|
+
alias such as `hi-female`), `language`, `tone`, `pace`, `instructions`, `breaths`, `naturalPauses`, `pronunciations`, `pronunciationDictionaryId`, `variant` and `model`, as in
|
|
201
202
|
`@sathamai/sdk`'s `audio.speech` (its README lists the values). `tts.updateOptions({...})` changes
|
|
202
203
|
them from the next sentence on; set one to `undefined` to clear it. A pause marker in the text
|
|
203
|
-
(`<break time="0.5s"/>`, 0.1 to 3 seconds) is spoken as that much silence
|
|
204
|
-
with `tone` or `pace`.
|
|
204
|
+
(`<break time="0.5s"/>`, 0.1 to 3 seconds) is spoken as that much silence, and a tone tag (`[happy]`) changes
|
|
205
|
+
the tone to the end of its sentence. `instructions` cannot be combined with `tone` or `pace`.
|
|
205
206
|
- **Errors** reach the session as LiveKit's own: `APIStatusError` for a refusal (401 and 400 are not
|
|
206
207
|
retried; 429 and 5xx are, as the session's `connOptions.ttsConnOptions` say), `APIConnectionError`
|
|
207
208
|
for a failed connection, and `APITimeoutError` when no audio comes within `timeoutMs`. A sentence cut
|
package/dist/realtime.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export declare const REPLY_TIMEOUT_MS = 10000;
|
|
|
33
33
|
* Every satham control (see `Controls` in `@sathamai/sdk`): OpenAI's names (`model`, `voice`,
|
|
34
34
|
* `modalities`, `turnDetection`, `temperature`, `inputAudioNoiseReduction`, `inputAudioTranscription`,
|
|
35
35
|
* `maxResponseOutputTokens`, `speed`, `toolChoice`) and satham's own (`greeting`, `language`,
|
|
36
|
-
* `languageSwitch`, `voiceOnLanguageSwitch`, `breaths`, `naturalPauses`, `continuation`, `phrasing`,
|
|
36
|
+
* `languageSwitch`, `voiceOnLanguageSwitch`, `breaths`, `naturalPauses`, `variant`, `continuation`, `phrasing`,
|
|
37
37
|
* `normaliseNumbers`, `pronunciations`, `topP`, `tone`, `repeatGuard`, `driftGuard`, and `agent`, an
|
|
38
38
|
* optional preset agent on the server). `modalities`, `turnDetection` and `inputAudioTranscription` also
|
|
39
39
|
* decide what the model tells LiveKit it does, so they are fixed for a model once made.
|
package/dist/tts.d.ts
CHANGED
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
* is made: 24 kHz, mono.
|
|
10
10
|
*
|
|
11
11
|
* One request runs at a time per `TTS`: the next sentence is asked for once the one before has
|
|
12
|
-
* arrived, which keeps a reply's sentences from queueing up against the server all at once.
|
|
12
|
+
* arrived, which keeps a reply's sentences from queueing up against the server all at once. Since each
|
|
13
|
+
* sentence is its own request, a tone tag in the text (`[happy]`) holds to the end of its sentence;
|
|
14
|
+
* `pronunciations` and `pronunciationDictionaryId` go with every sentence.
|
|
13
15
|
*/
|
|
14
16
|
import { type APIConnectOptions, tts } from '@livekit/agents';
|
|
15
17
|
import { type SpeechCreateParams } from '@sathamai/sdk';
|
|
@@ -34,6 +36,15 @@ export interface TTSVoiceOptions {
|
|
|
34
36
|
naturalPauses?: boolean;
|
|
35
37
|
/** `'kural-1'`, the default. */
|
|
36
38
|
model?: SpeechCreateParams['model'];
|
|
39
|
+
/**
|
|
40
|
+
* Words respelled for the voice, by language: `{ hi: { Skyline: 'स्काईलाइन' }, '*': { NAIC: 'N A I C' } }`
|
|
41
|
+
* (`*`: every language), up to 100 words; they win over the dictionary's.
|
|
42
|
+
*/
|
|
43
|
+
pronunciations?: SpeechCreateParams['pronunciations'];
|
|
44
|
+
/** One of your stored dictionaries (`client.pronunciationDictionaries`), applied to every sentence. */
|
|
45
|
+
pronunciationDictionaryId?: string;
|
|
46
|
+
/** The voice's sound: `'natural'` (the default) or `'warm'`. */
|
|
47
|
+
variant?: SpeechCreateParams['variant'];
|
|
37
48
|
}
|
|
38
49
|
export interface TTSOptions extends TTSVoiceOptions {
|
|
39
50
|
/** Your satham endpoint (`https://...`); `$SATHAM_URL`. */
|
|
@@ -43,7 +54,8 @@ export interface TTSOptions extends TTSVoiceOptions {
|
|
|
43
54
|
}
|
|
44
55
|
/**
|
|
45
56
|
* satham's text to speech (kural-1) for `voice.AgentSession({ stt, llm, tts })`. A pause marker in the
|
|
46
|
-
* text, `<break time="0.5s"/>` (0.1 to 3 seconds), is spoken as that much silence
|
|
57
|
+
* text, `<break time="0.5s"/>` (0.1 to 3 seconds), is spoken as that much silence, and a tone tag
|
|
58
|
+
* (`[happy]`) changes the tone to the end of the sentence.
|
|
47
59
|
*/
|
|
48
60
|
export declare class TTS extends tts.TTS {
|
|
49
61
|
#private;
|
|
@@ -52,8 +64,9 @@ export declare class TTS extends tts.TTS {
|
|
|
52
64
|
get model(): string;
|
|
53
65
|
get provider(): string;
|
|
54
66
|
/**
|
|
55
|
-
* Change the voice, language, tone, pace, instructions, breaths, natural pauses or model, from
|
|
56
|
-
* given options change; set one to `undefined` to clear it
|
|
67
|
+
* Change the voice, language, tone, pace, instructions, breaths, natural pauses, pronunciations, dictionary or model, from
|
|
68
|
+
* the next sentence on. Only the given options change; set one to `undefined` to clear it
|
|
69
|
+
* (`{ tone: undefined, instructions: '...' }`).
|
|
57
70
|
*/
|
|
58
71
|
updateOptions(options: TTSVoiceOptions): void;
|
|
59
72
|
/** Open a connection to the server before the first sentence (best effort), so it skips the handshake. */
|
package/dist/tts.js
CHANGED
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
* is made: 24 kHz, mono.
|
|
10
10
|
*
|
|
11
11
|
* One request runs at a time per `TTS`: the next sentence is asked for once the one before has
|
|
12
|
-
* arrived, which keeps a reply's sentences from queueing up against the server all at once.
|
|
12
|
+
* arrived, which keeps a reply's sentences from queueing up against the server all at once. Since each
|
|
13
|
+
* sentence is its own request, a tone tag in the text (`[happy]`) holds to the end of its sentence;
|
|
14
|
+
* `pronunciations` and `pronunciationDictionaryId` go with every sentence.
|
|
13
15
|
*/
|
|
14
16
|
import { APIConnectionError, APIStatusError, APITimeoutError, AudioByteStream, DEFAULT_API_CONNECT_OPTIONS, shortuuid, tts, } from '@livekit/agents';
|
|
15
17
|
import { Client, SathamError, SPEECH_SAMPLE_RATE } from '@sathamai/sdk';
|
|
@@ -62,7 +64,8 @@ class Turns {
|
|
|
62
64
|
}
|
|
63
65
|
/**
|
|
64
66
|
* satham's text to speech (kural-1) for `voice.AgentSession({ stt, llm, tts })`. A pause marker in the
|
|
65
|
-
* text, `<break time="0.5s"/>` (0.1 to 3 seconds), is spoken as that much silence
|
|
67
|
+
* text, `<break time="0.5s"/>` (0.1 to 3 seconds), is spoken as that much silence, and a tone tag
|
|
68
|
+
* (`[happy]`) changes the tone to the end of the sentence.
|
|
66
69
|
*/
|
|
67
70
|
export class TTS extends tts.TTS {
|
|
68
71
|
label = 'satham.TTS';
|
|
@@ -84,8 +87,9 @@ export class TTS extends tts.TTS {
|
|
|
84
87
|
return 'satham';
|
|
85
88
|
}
|
|
86
89
|
/**
|
|
87
|
-
* Change the voice, language, tone, pace, instructions, breaths, natural pauses or model, from
|
|
88
|
-
* given options change; set one to `undefined` to clear it
|
|
90
|
+
* Change the voice, language, tone, pace, instructions, breaths, natural pauses, pronunciations, dictionary or model, from
|
|
91
|
+
* the next sentence on. Only the given options change; set one to `undefined` to clear it
|
|
92
|
+
* (`{ tone: undefined, instructions: '...' }`).
|
|
89
93
|
*/
|
|
90
94
|
updateOptions(options) {
|
|
91
95
|
this.#voice = checked({ ...this.#voice, ...options });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sathamai/livekit-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "satham realtime speech-to-speech for LiveKit Agents (Node.js)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"satham",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"prepack": "npm run build"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@sathamai/sdk": "^0.1.
|
|
43
|
+
"@sathamai/sdk": "^0.1.4"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@livekit/agents": "~1.10.0",
|